use v6;
use HTTP::Server::Simple;
use CGI;
class WebApp is HTTP::Server::Simple {
method handler {
my $cgi = CGI.new;
my $name = $cgi.param('name');
$.remote.say("<html><head><title>Web App</title></head><body>");
if $name {
$.remote.say("<p>Hello {$name}.</p>");
} else {
$.remote.say('<form method="get">Name: <input name="name" /></form>');
}
$.remote.say("</body></html>");
}
}
WebApp.new( port => 8080 ).run;
The above now works in Pugs, as of r14679 or so. The fixes required to make this work were trivial, but the result is enormously satisfying. I can tell this thing will require further investigation. More tests are certianly needed to ensure that these modules continue to interact properly. First thing's first, however. I think I'll enjoy some nice Perl6 web hacking before bed tonight.
0 comments:
Post a Comment