Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

masak (6289)

masak
  (email not shown publicly)
http://masak.org/carl

Been programming Perl since 2001. Found Perl 6 somewhere around 2004, and fell in love. Now developing November (a Perl 6 wiki), Druid (a Perl 6 board game), pls (a Perl 6 project installer), GGE (a regex engine), and Yapsi (a Perl 6 implementation). Heavy user of and irregular committer to Rakudo.

Journal of masak (6289)

Wednesday May 13, 2009
04:38 PM

Week 7 of Web.pm -- blogs, Hitomi and server agnosticism

[ #38973 ]
Cheezburgrz 4 teh n00b kittehs, theys can has teh Ceiling.
Cheezburgrz 4 teh sad kittehs, theys can has petting.
Cheezburgrz 4 teh m33k kittehs, theys can has teh urfs.
Cheezburgrz 4 teh kittehs who sez "I can has gud, plz?", theys can has it.
Cheezburgrz 4 teh kittehs dat no pwns, Ceiling Cat no pwnz0rz thems.
Cheezburgrz 4 teh kittehs wiff purr in hartz, theys can sees Ceiling Cat.
Cheezburgrz 4 teh kittehs dat sez shhhhh!, Ceiling Cat is liek "u mai kittehs."
Cheezburgrz 4 teh kittehs dat gets pwned by otehrs fur haz gud, theys can has teh Ceiling too.
Cheezburgrz if otehrs be liek "DO NOT WANT" 2 u, an liez abt u, coz of meh.
B teh happys n party, coz u can has cookiez n cakez in Ceiling. Iz liek wen theys been liek "DO NOT WANT" to all teh holee kittehs b4. — Matthew 5:3-12

Another nice week with Web.pm. They usually start out slow, as if to give me some breathing-room after writing the previous week's summary, and then they just tend to take off, with more and more leads to follow. Furthermore, this increase seems to become stronger each week — a kind of meta-increase, if you will.

  • My Saturday build-a-blog-in-90-minutes spree inspired Tene++ to do the same, except he did it in 20 minutes, and his source code looks much cooler than mine. Besides using his module Tags, which I also used, he also effortlessly does dispatching with his amazing 16-line module LolDispatch. It uses a feature in Rakudo called "trait handlers", which I wasn't even aware existed before I saw it in Tene's code.
  • Apart from LolDispatch and Ilya's Routes, there's now also a new dispatcher called Faz. This one was created by ruoso++, and it works by registering the URL regexes that participate in the dispatch, and compiling them into one unit which then handles all the request URLs. After writing this dispatcher, ruoso also ported my quick-and-dirty blog engine. Here's the ported blog engine, and here's the dispatcher. Go look at it, it's cool stuff.
  • It feels kinda nice to have a short public programming session of mine cause two people to independently turn my unworthy code into two different kinds of great, and this within the course of three days. Clearly, I should do more of these slightly insane coding marathons.
  • (Oh, and the eventual goal is to be able to do a blog engine in 3 to 5 minutes on Web.pm. But I think we'll need our Rails/Catalyst idea to be able to pull that off.)
  • Yesterday, viklund and I had a hackathon — the first Tuesday in quite some time when we were both available. Since those Tuesday hacking sessions are really meant for Novermber work but my head was full of Web.pm stuff, we compromised and started experimenting with the Hitomi prototype, which will hopefully be suitable for November some day. The reason I still consider Hitomi being stuck in prototype mode is that none of us have yet managed to build both the bottom-up parser (using grammar actions) and the top-down parser (that does the actual template substitutions), and have these play nicely together.
  • But in yesterday's pair programming session, we made some real progress in a number of ways. I finally grokked the make call. (It's not that hard, really. It just sets the .ast property on the Match object to whatever you pass it.) We actually got a pl:if directive to behave as we wanted, that is we got it to appear and disappear based on the truth value of an expression. After I reluctantly left, viklund kept hacking on the proof-of-concept. As I write this, he's still at it: here's the latest version. viklund++
  • I realized, when explaining Hitomi to viklund, that I haven't really (apart from some semi-coherent IRC ramblings) taken the time to output the part of its design that I've nailed down so far into a substrate outside of my brain. So here's a short summary: templates contain value substitutions, if-directives and for-loops. Value substitutions look like this right now in Hitomi: ${ $value }. They can occur in the content between tags, and as part of attribute values. If directives are simply elements with a pl:if attribute. The value of that attribute is evaluated as a Perl 6 expression, and the boolified result determines whether to serialize the whole element in question. For loops, correspondingly, are elements with pl:for attributes. The value of those attributes are also expressions, often evaluating to lists, which are then looped over. But there's a twist: you can also have the attribute value contain something like "@list -> $elem", and (just as in Perl 6 for-loops) the variable $elem will be magically available within the children of that element node. (Бог knows how we'll implement that last part, but the idea just feels too good to leave out.)
  • At present, all the evaluations are done in the application itself, not because we like it that way, but because we're trying to get something to work. I plan to do a second dive into Genshi and see how they do the whole evaluation thing. Intuitively, working on some kind of data object which holds results from a database call seems much saner.
  • Finally, today there was a short discussion about Web.pm on #perl6. Among other things, we concluded that Web.pm aims to be server-engine-agnostic, but that it isn't really at this point. In fact, more and more examples are being created where mberends++' HTTP::Daemon is assumed to be the only web server in the world. (Partly because, at this point, it kinda is.) Anyway, I feel an obligation to port some more of Rack to at least make it possible to code web applications in as agnostic a way as possible. I will revisit the Rack design and source code in the coming weeks.

All in all, a lot is happening, and my weekly agenda is starting to write itself to some extent. People are actually coming up to me on IRC and asking about Web.pm, which is both exhilirating and a bit scary. Need to fix all those things that don't work yet...

I wish to thank The Perl Foundation for sponsoring the Web.pm effort.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.