Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

gav (2710)

gav
  (email not shown publicly)
http://www.estey.com/
AOL IM: flufflegavin (Add Buddy, Send Message)

Hacker in NYC.

Journal of gav (2710)

Wednesday July 02, 2003
09:21 PM

CGI programming in Perl1

[ #13217 ]

Since Michael Schwern became perl1 pumpking I've had crazy ideas about backporting cgi-lib to perl1. This is as far as I've got so far, but I'm plugging away.

#!/usr/bin/perl1
print "Content-Type: text/plain\n\n";

do ReadParse();

while (($k, $v) = each(vars)) {
    print "$k = $v\n";
}

sub ReadParse {
    $_ = $ENV{'QUERY_STRING'};
    @in = split(/&/);
    for ($i = 0; $i <= $#in; $i++) {
        $in[$i] =~ tr/+/ /;
        if ($in[$i] =~ /^([^=]+)=(.*)/) {
            $vars{$1} = $2;
        }
    }
}

The cool thing about perl1 is that the binary is only 162k and it compiles fine on OS X.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.