PQUERY

PQUERY


This post is not specifically about jQuery, but might be interesting
brain food to its developers.
As I said before, I'm working on pQuery, which is a jQuery port to
Perl.
I was showing pQuery to my good friend Gugod (he introduced me to
jQuery in the first place). He said in passing "You should make pQuery
be able to work against multiple documents. That's one thing jQuery
doesn't do."
At first I thought he was crazy. Then my brain hurt for a bit. Then I
decided against it since i want pQuery to be very close to jQuery.
Then I thought, why not make a simple wrapper class to do it? I
decided to call the wrapper class PQUERY.
After a bit of coding I got this Perl one liner to work from the
command line:
> perl -MpQuery -le 'PQUERY(\
map "http://search.cpan.org/~$_/", qw(ingy gugod miyagawa)\
)->find("table")->eq(1)->find("tr")\
->EACH(sub{\
printf("%40s - %s Perl distributions\n", $_->url, $_-