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;

# haiku - front-end for haiku spewer
# Development version 08: add HTML markup with command line flag
# Steve Kinzler, kinzler@cs.indiana.edu, Jan 96

$usage = "usage: $0 [ -t ] [ -l ] [ number ]
        -t      output text format, haiku only (default full HTML page)
        -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/,\n/,<br>\n/g;
                s/\.\n/.<p>\n/;
        }

        print;
}

close HAIKU;