CGI - A module for programming CGI
use v6-alpha; use CGI; my $q = CGI.new; print $q.header; if ($q.param) { for $q.param -> $key { say $key ~ " => " ~ $q.param($key) ~ "<BR>"; } } else { say "<FORM><INPUT TYPE='text' NAME='test'><INPUT TYPE='submit'></FORM>"; } # you can also test it on the command line too % pugs -I lib/ examples/test.pl "greetings=hello world"
CGI for Perl6!
Create a new object CGI object.
my $q = CGI.new;
You can also initialize the object with your own hash of parameters:
my $q = CGI.new( a => 'b');
The following informational functions are fetched on-demand
The Dump method produces a string consisting of all the query's name/value pairs formatted nicely as a nested list. This is useful for debugging purposes:
Dump
print $q.Dump;
Produces something that looks like:
<ul> <li>name1 <ul> <li>value1 <li>value2 </ul> <li>name2 <ul> <li>value1 </ul> </ul>
stevan little, <stevan@iinteractive.com>
Audrey Tang, <autrijus@autrijus.com>
Curtis "Ovid" Poe
Andras Barthazi, <andras@barthazi.hu>
"Aankhen"
Mark Stosberg
Parts Copyright (c) 2005. Stevan Little. All rights reserved. Parts Copyright (c) 2006. Mark Stosberg.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Perl6::Pugs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl6::Pugs
CPAN shell
perl -MCPAN -e shell install Perl6::Pugs
For more information on module installation, please visit the detailed CPAN module installation guide.