I’ve still been working on the Web libraries for Perl 6.
In the past week, I’ve improved my Tags library to handle more common cases and be easier to use, I migrated HTTP::Daemon to use Parrot sockets instead of exec-ing socat, and I wrote a basic pastebin: http://github.com/masak/web/blob/c84c4c1892463459e406958db8f9232e7b7bf5d1/bin/kopipasta.pl.
You might be able to see a running instance here: http://pleasedieinafire.net:2080/. That host has poor connectivity lately, though.
I’ve also played a bit with some ideas related to dispatch. Here’s an example I got working on the plane home from Boston:
use LolDispatch;
use HTTP::Daemon;
sub item($request, $match) is handler(/^\/item\/(\d+)/) {
say 'dispatched to item';
say $match.perl;
}
my $request = HTTP::Request.new(
req_url => HTTP::url.new(path => '/item/12345'),
headers => HTTP::Headers.new( header_values => { 'Host' => 'localhost' }),
req_method => 'GET',
);
dispatch($request);
Here’s the output of that example:
dispatched to item
Match.new(
# WARNING: this is not working perl code
# and for debugging purposes only
ast => "/item/12345",
text => "/item/12345",
from => 0,
to => 11,
positional => [
Match.new(
ast => "12345",
text => "12345",
from => 6,
to => 11,
),
],
)