24 lines
389 B
Plaintext
24 lines
389 B
Plaintext
|
#!/usr/pkg/bin/perl
|
||
|
|
||
|
$GFORTH = '/arpa/ns/p/papa/bin/gforth-0.7.0';
|
||
|
|
||
|
$query = $ENV{'QUERY_STRING'};
|
||
|
$query =~ s/\+/ /g;
|
||
|
$query =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge;
|
||
|
|
||
|
open(RESULT, '-|', "$GFORTH -e '$query CR BYE'") or die "Can't start gforth: $!";
|
||
|
|
||
|
$result = <RESULT>;
|
||
|
|
||
|
chop $result;
|
||
|
|
||
|
print <<END ;
|
||
|
Content type: text/plain
|
||
|
|
||
|
$query ==> $result
|
||
|
END
|
||
|
|
||
|
while (<RESULT>) { print "\t\t$_"; }
|
||
|
|
||
|
|