Source of template.plp
Back
  1. <(template.plp)>
  2. <:

  3. use POSIX qw/strftime/;

  4. BEGIN { $title = 'Files' }

  5. sub file {
  6.     my ($file, $type) = @_;
  7.     my $comment = $file->[1];
  8.     $comment .= strftime(', %B %e, %Y', localtime($file->[2])) if $file->[2];
  9.     return qq{<img src="/pix/$type.png" width=32 height=32 alt="" align=middle>} .
  10.            qq{<a href="files/$file->[0]">$file->[0]</a> ($comment)<br>};
  11. }

  12. chdir 'files';

  13. my (@old, @tgz, @deb, @dir);

  14. opendir my $handle, '.';
  15. for (reverse sort readdir $handle) {
  16.     next if /^\./;
  17.     if (/plp\d\d\d\.tgz$/) {
  18.         push @old, [ $_, -s, (stat)[9] ];
  19.     } elsif (/^PLP-[\d.]+\.tar\.gz$/) {
  20.         push @tgz, [ $_, -s, (stat)[9] ];
  21.     } elsif (/\.deb$/) {
  22.         push @deb, [ $_, -s, (stat)[9] ];
  23.     } elsif (/^PLP-[\d.]+$/) {
  24.         push @dir, [ $_, 'dir', (stat)[9] ];
  25.     }
  26. }
  27. closedir $handle;

  28. item 'Module distributions';
  29. print file($dir[0], 'dir' );
  30. print file([ "$dir[0][0]/Changes", -s "$dir[0][0]/Changes", (stat _)[9] ], 'txt');
  31. print map file($_, 'tgz'), @tgz;

  32. item 'Debian packages';
  33. print map file($_, 'deb'), @deb;

  34. item 'Old CGI+module distributions';
  35. print map file($_, 'old'), @old;

  36. :>