Here's my first stab at a perl 6 cgi script. It's unusably slow under
pugs, but that's a problem for the "optimisation people" :-) not me!
If I'm reinventing the wheel here just tell me, but it's still a
useful learning exercise (I'm embarrassed to tell you how long this
took me to get working!). Wanna add code for the TODO's?
====begin code
#!/usr/bin/pugs
say "content-type: text/html\n\n";
my %q = ();
my @q = split '&', %ENV.{'QUERY_STRING'};
for (@q) {
my ($n, $v) = split '=', $_;
# TODO: deal with URI encoding
# similar to perl5: s/%(..)/pack("c",hex($1))/ge;
#TODO: handle multiple values and same key
%q.{$n} = $v;
}
for (%q.keys) { say $_, " => ", %q.{$_}, "<br>"; }
====end code
--michael