#!/usr/pkg/bin/perl
#+JMJ
# template.pl - Perl script template (command line)
# Copyright 201x David Meyer. All rights reserved.
# template.pl is part of template
# Identification ####################################################
$PROGRAM = 'template' ;
$VERSION = '0.0' ;
$SRCFILE = 'template.pl' ;
$COPYRIGHT = 'Copyright 201x David Meyer' ;
$DESCRIPTION = 'Perl script template (command line)' ;
$USAGE = "Usage: template [<options>] [<argument> ...]" ;
$CONTACT = 'David Meyer <
[email protected]>' ;
$prevmo = $prevda = $prevyr = "";
open(BLINKS, "ls -lt `find /arpa/ns/p/papa/cave/green/ -name *.blink`|");
while (<BLINKS>) {
chop $_;
($tpm, $hlc, $own, $grp, $siz, $mmo, $mda, $mty, $fn) = split(/\s+/, $_);
if ($mty =~ /:/) {
if ($mmo ne $prevmo || $mda ne $prevda) {
if ($prevmo ne "") { print "</ul>\n"; }
print "<h2>$mmo $mda</h2>\n<ul>\n";
}
}
else {
if ($mmo ne $prevmo || $mda ne $prevda || $mty ne $prevyr) {
if ($prevmo ne "") { print "</ul>\n"; }
print "<h2>$mmo $mda, $mty</h2>\n<ul>\n";
}
}
$prevmo = $mmo; $prevda = $mda; $prevyr = $mty;
$fn =~ m:([^/]+)/[^/]*$:;
$cat = $1;
open(BLINK, "<$fn");
$title = <BLINK>;
$uri = <BLINK>;
close BLINK;
chop($title, $uri);
print "<li><a href=\"$uri\">$title [$cat]</a></li>\n";
}
print "</ul>\n";