Recently in Grant Category

Blog speed-run.

| 175 Comments | No TrackBacks

On Sunday, before I left for my flight, I saw masak chatting on IRC about his blog speed-run, which I later found described here. He set a time limit to see how quickly he could implement a basic blog app on the tools we've been building.

At the airport later that day, I had 20 minutes to wait before boarding my flight, so I thought I'd try the same thing. Omgblog is what I got done before I needed to board. I'll try to leave it running for a while. The source is in the usual place.

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,
    ),
 ],
)

I'm participating in the web framework for Perl 6 grant from The Perl Foundation. My first task has been working on a Tags library for (X)HTML generation.

I've got the start of a simple port of Template Declare implemented. It's not perfect, and I'm still working out the API we want, but it's functional, and nice. It's quite a bit nicer than CGI.pm-style html generation.

The philosophy of this library is that templates are code, and we should be able to deal with them as such. If your template is Perl, you can use all of the same tools you use for Perl. No need to learn a new language, and far fewer angle brackets. :)

Here's an example that runs under the current Tags.pm. Keep in mind, there's still a decent amount of API refactoring needed.

use Tags;
say show {
    html {
        head { title { 'Tags Demo' } }
        body {
            outs "hi";
            ul :id<numberlist> {
                outs "A list from one to ten:";
                for 1..10 {
                    li :class<number>, { $_ }
                }
            }
        }
    }
}

About this Archive

This page is an archive of recent entries in the Grant category.

Parrot is the next category.

Find recent content on the main index or look in the archives to find all content.

Grant: Monthly Archives

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.32-en