Previous <-->
Next <==>
All
#!/usr/local/bin/perl -s
$ENV{'PATH'} .= ":$ENV{'HOME'}/l/fun/bin:" .
"$ENV{'HOME'}/l/fun/bin/$ENV{'ARCHIT'}:" .
"/usr/local/games:/usr/games";
$ENV{'PATH'} .= ":/u/kinzler/l/fun/bin:/u/kinzler/l/fun/bin/sun4";
$dfltnum = 5;
$dicturl = 'Dict_URL';
# haiku - front-end for haiku spewer
# Development version 09: add dictionary links with command line flag
# Steve Kinzler, kinzler@cs.indiana.edu, Jan 96
$usage = "usage: $0 [ -t ] [ -d ] [ -l ] [ number ]
-t output text format, haiku only (default full HTML page)
-d don't include dictionary links in HTML output
-l output single-line haiku format (default multi-line format)
The given number of haiku are generated, default $dfltnum.\n";
die $usage if $h || $ARGV[0] !~ /^\d*$/;
$num = $ARGV[0] || $dfltnum;
###############################################################################
open(HAIKU, "spew $num haikus |") || die "$0: cannot run spew ($!)";
$* = 1;
while (<HAIKU>) {
$_ = "\u$_";
unless ($l) {
s:^:\n: if $. > 1;
s: / :,\n:g;
}
unless ($t) {
s/\w+/<a href="$dicturl$&">$&<\/a>/g, s/> +/>\n/g unless $d;
s/,\n/,<br>\n/g;
s/\.\n/.<p>\n/;
}
print;
}
close HAIKU;