#!/var/lib/apache2/fcgid/a2wserver/perl588/bin/perl -w

eval 'exec /var/lib/apache2/fcgid/a2wserver/perl588/bin/perl -w -S $0 ${1+"$@"}'
    if 0; # not running under some shell

use strict;
use Term::ReadLine ();
use Text::ParseWords qw(shellwords);

system("ppm", "--version");
exit 1 if $? != 0;

my $term = new Term::ReadLine 'PPM';
my $prompt = "ppm> ";
my $OUT = $term->OUT || \*STDOUT;
while ( defined ($_ = $term->readline($prompt)) ) {
    last if /^(quit|exit)$/;
    my @w = shellwords($_);
    if (@w) {
	system("ppm", @w);
        $term->addhistory($_);
    }
}
print "\n";
