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 ]

rhesa (5696)

rhesa
  (email not shown publicly)

Journal of rhesa (5696)

Friday December 28, 2007
12:11 AM

UNIVERSAL::isa oddity?

What's going on here?

   my $foo = bless [], 'foo';
 
   # yep, it's a foo
   $foo->isa('foo') and print "it's a foo";
 
   # what about the parent?
   $foo->SUPER::isa('foo') and print "Mommy is a foo too";

I suppose it doesn't make much sense to be asking isa() on the superclass, but huh?

Friday December 07, 2007
08:06 PM

Squeezebox, with Perl

Today, my Squeezebox (from http://www.slimdevices.com/) arrived in the mail. Its streaming server is written in Perl :-)

I've only glanced at the code, but it looks very well layed out, and uses great modules like TT2 and DBIx::Class. And it's all GPL'ed too, nice!

If you're looking for a good quality, wireless media player, the Squeezebox should be on your list.

Thursday March 29, 2007
09:01 PM

Two small gripes about MySQL

  1. You can use an aliased column in the GROUP BY clause, but not in the WHERE clause:

    SELECT func(foo) as alias FROM baz GROUP BY alias

    works, but

    SELECT func(foo) as alias FROM baz WHERE alias='quux'  (*)

    doesn't. You have to write

    SELECT func(foo) as alias FROM baz WHERE func(foo)='quux'

  2. Modifying a column: which phrase will do what I want? ALTER COLUMN, CHANGE COLUMN, or MODIFY COLUMN? I can never remember and have to look them up.
Saturday May 20, 2006
03:09 PM

New fbi packages fix denial of service

Normally, security updates are just part of ordinary life. Today's Debian Security Announcement brought a smile to my face though.

[SECURITY] [DSA 1068-1] New fbi packages fix denial of service

[...]

We recommend that you upgrade your fbi package.

Saturday May 06, 2006
05:58 AM

"Mocking Everything"

It's a saturday morning, and it's my first free weekend in months. I feel like unloading some static. Don't read this, it's silly! My bozo bit seems to be stuck today, so I need a coredump.

Perl gets a bad rap
First item is this post: it tickles me, because i think it's weird to turn some cracker's actions into bad publicity for one of his tools.

"Gary told me over a couple of Heinekens [Heineken involved in NASA cracking attempt!!] that he used emacs to type his perl script." -- Anonymous bartender
Emacs is evil! Had he used vi, he wouldn't have been caught!

web frameworks

Jifty is doomed!
Paul Graham holds a patent on using continuations to fake subroutines in web applications -- and he suspects they have been made obsolete by Ajax anyway.

Catalyst lost its Mojo
Inspired by the recent upheaval, I'm building a whole new framework from the ground up, and I'm calling it Devil::Fork. It'll take all the bad design decisions of all frameworks in existence, and extends them for all eternity. I'm already making a mockery of MVC with Devil::Fork::Trident.
The most important factor in the success of any framework is marketing, so I'm currently sketching Devil::Fork::Pitch. I wonder if Keanu and Al are interested in a sequel...

When HTML just isn't rich enough
I have plans for a gooey toolkit for a richer experience, and this will be its entry in the module list: Devil::Fork::You -- GUi toolkit based on Curses.

The good guys are winning!
Apparently there aren't enough object factories yet. I was quite thrilled when the butchers came in to turn Perl objects inside out. But when a moose weazeled its way onto the CPAN, I got worried. And now I see more religion being considered for inclusion!

Listen, there are only four classes: Nobility, Bourgeoisie, Proletariat and Pariahs. It's worked forever. And they never mix. No need to go tampering with establishment!

Form validators
Another area with lots of false prophets. CGI, Data::Formvalidator, CGI::Untaint, HTML::Widget, and more recently, Class::CGI all claim to make web data access safe. Nonsense! I have the definitive one, and it's going to be released as CGIx::Class. I really hope I can make fun of Ovid, Tony Bowden, Matt Trout _and_ Sebastian Riedel all in one fell swoop!

Templating systems
Haha. That's too funny even for this clown. My work here is done.

Monday September 05, 2005
06:51 PM

Perl help for a Master Katrina db at The Katrina Portal

I'm working with a group of people to build a central database for the survivors of Katrina and their relatives (up on http://www.thekatrinaportal.com/).

We could use volunteers and other help with this effort, so drop me a line if you want to help out.
We're specifically looking for scraping experts, and help on the web interface/xml api to get the data back out to others.
What we have now is built with CGI::Application and Class:DBI (and HTML::Template::Plugin::Dot), so if you're familiar with those, all the better.

I'm pasting Britt Blasers request here:

What we're doing

Donovan Janus and Rhesa Rozendaal are building a Katrina Data Aggregator at The Katrina Portal, which should go live at by about noon EDT today. The Katrina Portal allows people to enter data like all the others, but its real purpose is for volunteers to copy text information from text lists and to enter it into a structured format.

Then the site exposes the data through XML-API to any agency that needs it. It can also create overviews of tabular and graphical views for use in decision support for relief management and for the Main Stream Media.

John Vincenzo has started to re-purpose an existing pattern recognition tool to spider the lists for importing text and starting the data normalization.

Or, roll your own.

What we need

We need one or more Perl coders to help finish John's GREP pattern matcher to spider the lists for importing text. It's based on a tool he built at UBS Warburg in 1996 for pattern recognition in huge ASCII files from the New York Stock Exchange. John is very busy, including the fact that his brother lost everything in Katrina, and is slightly injured.

The two tasks are to finish the tool and to configure data descriptions for each of the uniquely configured lists, which volunteers can do.

Can anyone help? Can you hook John up with someone who can?

That's probably enough for the three of you to totally get it. The rest of this message is background.

The original plea inspiring the Katrina Portal, from Brian Oberkirch to Doc Searls on Thursday, is attached below. FWIW, our two stateside programmers, Rhett Brown and John Vincenzo, have lost a total of four homes in their immediate families. Donovan Janus in Australia and Rhesa Rozendaal in Norway are working just as hard on the Katrina response.

Thanks in advance,

Britt Blaser

Begin forwarded message:

> From: Doc Searls
> Date: September 1, 2005 3:59:32 AM EDT
> To: Britt Blaser
> Subject: Fwd: Social Web Help for Slidell Hurricane Victims?
>
>
> I think some of your friends might have ideas.
>
> ds
>
>> To: Jason Fried , Dave Winer ,
>> , hugh macleod ,
>> Craig Newmark , Evan Williams ,
>> Dan Cederholm , Doc Searls ,
>> Cc: David Parmet
>> Subject: Social Web Help for Slidell Hurricane Victims?
>> From: Brian Oberkirch
>> Date: Thu, 1 Sep 2005 00:06:35 -0500
>
>> Anyone have any ideas about how I can get this data out & circulating for greater effect? Today, I posted a link to a CNN video. Jennifer Watson posted a comment that she had been looking for her father since Sunday, and through the video was able to find out that he was alive & ok. I want more stories like this, but the requests are buried in comments. How can I amp up the social interaction? Any thinking greatly appreciated. Our little town is crushed. Help us, Obi-Wan. Thanks much. Peace & light.
>
>>
>>
>> http://www.lightbox5.com/movabletype/archives/2005/08/lazyweb_dont_fa.html
>
>>
>> LazyWeb, Don't Fail Me Now
>
>> Over at the Slidell Hurricane Damage blog, I have hundreds of people posting comments asking about loved ones, damage, etc. Many email me, and I post up their inquiries. I'm afraid the requests are hidden away in the comments. Anyone have a quickie Web 2.0 way I can extract and circulate this information to let the hive mind work its magick?
>
>> Need the social Web bomb squad on this. People need help. I want to help them.
>
>> Hey Tech Pros, you asked what you could do to help. Here's one thing you could help me with.
>
>>
>>
>> Brian Oberkirch
>
>>

Monday August 29, 2005
09:28 AM

Use Perl Journals RSS feed

Anyone know if that feed has changed? Up until Aug 17th, I'd get the latest journal entries, including body. After that date, nothing.

How do I keep track of who's writing what now? I don't want to have to refresh the home page every hour.

update: ok, the feed's still there, but why is the body gone? I want to see some content! Just the subjects is meaningless.

Tuesday August 16, 2005
08:55 PM

more progress on HTML::Template::Plugin::Dot

HTML::Template::Plugin::Dot is nearing 1.0!

In the past few days, I've made numerous improvements and bugfixes. The most notable of those is loop support: anything returning an array (or reference to one) can be used in a tmpl_loop:

use HTML::Template::Pluggable;
use HTML::Template::Plugin::Dot;
use My::Feed;  # a Class::DBI object
 
my $tmpl = q{
Feed: <tmpl_var feed.name> at <tmpl_var feed.url>
Items:<tmpl_loop feed.items:item>
    "<tmpl_var item.title>" by <tmpl_var item.author> (<tmpl_var item.postdate.dmy>)
</tmpl_loop>
};
 
my $t = HTML::Template::Pluggable->new( scalarref => \$tmpl );
 
my $feed = My::Feed->retrieve(1);
$t->param( feed => $feed );
 
print $t->output;

Notice how we only pass in the $feed object, and make use of its relationships to display its items. The ':item' suffix works similar to foreach my $item( $feed->items ). I even provide the equivalent of $_ as an implicit local variable, but I've chosen to name it "this", since that's what web designers would be more familiar with than a bare underscore ;-)

The other big improvement is that HTML::Template::Pluggable and ::Plugin::Dot now pass all of the original HTML::Template tests, which means it can be used as a drop-in replacement.

The last bit of big news is that CromeDome has released a plugin for CGI::Application that makes the drop-in even smoother! All you need to do is make a small change to your base class, adding CGI::Application::Plugin::HTDot to its @ISA. All your existing code will keep working as before, but the new dot power is available everywhere, ready for you to tap into.

I'm quite thrilled about my progress, and about CromeDome's plugin :-)

I'm now at a stage where I can go try out all this new power and flexibility. I'm going to see about benchmarking as well; maybe there are performance issues I do not know about yet. But at least it's stable, and that's the important part.

Sunday August 07, 2005
08:28 PM

Progress on HTML::Template::Plugin::Dot

As you may know, Mark Stosberg and I are working on additions to HTML::Template. Mark has created HTML::Template::Pluggable, which adds a callback system to HTML::Template, similar to the successful one in CGI::Application. This will make creating plugins for HTML::Template a lot simpler.

He also started on HTML::Template::Plugin::Dot, which hooks into param to provide the magic-dot notation you might know from the Template Toolkit. I am currently enhancing that to allow mixing hashes and objects and more.

Here's an example script I have just written:

use HTML::Template::Pluggable;
use HTML::Template::Plugin::Dot;
use My::Feed;  # a Class::DBI object
 
my $t = HTML::Template::Pluggable->new( scalarref => \ q{
    Feed: <tmpl_var feed.name> at <tmpl_var feed.url>
    Items:<tmpl_loop items>
        "<tmpl_var item.title>" by <tmpl_var item.author> (<tmpl_var item.postdate.dmy>)</tmpl_loop>
    });
 
my $feed = My::Feed->retrieve(1);
$t->param( feed => $feed,
           items => [ map { {item => $_} } $feed->items ] );
 
print $t->output;

Sample output could look like this:

    Feed: Asynchrss at http://www.asynchrss.com
    Items:
        "News" by rhesa (21-10-2004)
        "More" by zsane (04-07-2005)

Hey, that's neat! Now, what if your web designer wants american style dates?

<tmpl_var item.postdate.mdy('/')>

Output:

    Feed: Asynchrss at http://www.asynchrss.com
    Items:
        "News" by rhesa (10/21/2004)
        "More" by zsane (07/04/2005)

And no changes to your code whatsoever! Now all you need to tell your designer is what objects he can expect, and what methods he can call. But you have that documented already, right? ;)

Obviously we're not intending to redo the Template Toolkit, but I think this feature is a great addition to HTML::Template, and a much-requested one at that. It's still fully backward-compatible too, so none of your existing code will break.

It should be on CPAN sometime soon, but you can get it from Marks public darcs repo now. I could definitely use some eyeballs on my code, as well as more tests. So get in touch if you're interested!

Thursday August 04, 2005
05:15 PM

hooked on markjugg

So, first he gives us callbacks in CGI::Application. Soon we'll have them in HTML::Template too. And if that's not enough, he's enabling magic-dot notation as well!

Three cheers for Mark! Yay Mark, way to go :)))))

Ok, so I thought it would be cool to be able to pass arguments to method calls as well, so you can do, say,

<tmpl_var datetime.strftime(%c)>

And mix method calls and hash-key referencing:

<tmpl_var mock.method.some_key>

That would help, for instance, when that method returns a hashref, or when a hash contains some objects.

I've got something thrown together at the moment, but it's still crude. These two samples work though :)