Hi! Please consider following me on twitter: @hanekomu.

Hook::Modular 0.01

I've released the first alpha version of Hook::Modular.

Hook::Modular makes writing pluggable applications easy. Use a config file to specify which plugins you want and to pass options to those plugins. The program to support those plugin then subclasses Hook::Modular and bootstraps itself. This causes the plugins to be loaded and registered. This gives each plugin the chance to register callbacks for any or all hooks the program offers. The program then runs the hooks in the order it desires. Each time a hook is run, all the callbacks the plugins have registered with this particular hook are run in order.

The code is almost completely lifted from Plagger, so really Tatsuhiko Miyagawa deserves most of the credit.

Write a comment | Bookmark and Share

posted at: 21:55 | path: /dev | permalink | 0 comments | 0 trackbacks

18 days later

Has it really only been two and a half weeks since the end of YAPC::EU 2007? In this relatively short time I have already discovered some new technologies/toys, and have started to use others that I knew before but didn't really have any time or motivation to explore. Among them are, in no particular order: Plagger, SVK, del.icio.us, Twitter, Vox, Web::Scraper, ShipIt, Module::Install, miro, tvrss.net, OpenID, last.fm, SlideShare, Dopplr, TheSchwartz, Kwalify, Data::ObjectDriver, memcached, Test::Base and more.

I feel a bit like I imagine the Japanese must have felt in 1854 when Commodore Perry landed and pretty much kicked them into the technological reality of the day.

Normally a month goes by much too fast, but this time there's been so much happening in those 18 days that YAPC::EU feels long ago already.

So, thank you, Perl community; thank you, YAPC::EU!

Tags: , .

Write a comment | Bookmark and Share

posted at: 11:07 | path: /misc | permalink | 0 comments | 0 trackbacks

Plagger hack: Engrish.com Recent Discoveries custom feed

I've been playing with Plagger, the Pluggable RSS/Atom Aggregator, to create a custom feed for Engrish.com's "recent discoveries". The HTML on that page is pretty convoluted, consisting of at least six or seven levels of nested tables, rows and cells, but a combination of Web::Scraper and XPath made it easy to get at the required information.

Here is the Plagger workflow:

global:
  log:
    level: error
plugins:
  - module: Subscription::Config
    config:
      feed:
        - script:///home/gr/plagger/feeds/engrish_com-recent_discoveries.pl
  - module: CustomFeed::Script
  - module: Publish::Feed
    config:
      dir: /path/to/htdocs/feeds
      filename: engrish_com-recent_discoveries.rss
      format: RSS

And here is the script (engrish_com-recent_discoveries.pl) referenced by the workflow:

#!/usr/bin/env perl

use strict;
use warnings;
use Web::Scraper;
use URI;
use YAML;
use DateTime;
use DateTime::Format::W3CDTF;

my $uri = URI->new('http://engrish.com/recent.php');

my $s = scraper {
    process '//a[contains(@href,"recent_detail.php")]',
        'entries[]' => {
            link  => '@href',
            title => scraper {
                process 'img', title => '@alt';
                result 'title';
            },
        }
};

my $feed = $s->scrape($uri);
splice @{ $feed->{entries} || [] }, 10;

$feed->{title} = 'Engrish.com Recent Discoveries';
$feed->{link} = $uri->as_string;

for my $entry (@{ $feed->{entries} }) {

    # extract the date from the 'link' key; it looks something like
    #
    # recent_detail.php?imagename=foobar.jpg&category=Clothing&date=2007-09-12

    if ($entry->{link} =~ /date=(\d{4})-(\d{2})-(\d{2})/) {
        my $date = DateTime->new(
            year  => $1,
            month => $2,
            day   => $3,
        );
        $entry->{date} = DateTime::Format::W3CDTF->format_datetime($date);
    }

    if ($entry->{link} =~ /imagename=(.*?)&/) {
        $entry->{body} = qq!<img src="http://engrish.com/image/engrish/$1" />!;
    }

    $entry->{link} = 'http://engrish.com/' . $entry->{link};
}

print Dump $feed;

At the moment, I run this workflow once per hour, and you can subscribe to the feed. I subscribe to it using Bloglines. Combined with the Plagger workflow that takes Bloglines feeds and publishes them to Gmail, this means that I can now see new Engrish discoveries from within the Gmail reader.

Write a comment | Bookmark and Share

posted at: 08:44 | path: /dev | permalink | 0 comments | 0 trackbacks

More module updates

I've released Attribute::Overload 0.03, Attribute::TieClasses 0.02, and Bundle::Perl6 0.08.

These releases are functionally equivalent to the previous release, but they have been converted to a new-style distribution (ShipIt, Module::Install); test files have been moved to their proper locations and documentation has been fixed.

Write a comment | Bookmark and Share

posted at: 14:27 | path: /dev | permalink | 0 comments | 0 trackbacks

Data::Inherited 1.01

I've released Data::Inherited 1.01.

This release is functionally equivalent to the previous release, but it has been converted to a new-style distribution (ShipIt, Module::Install); test files have been moved to their proper locations and documentation has been fixed.

It still contains Damian Conway's NEXT.pm, because it needed to be patched and although I'd sent the patch to Damian years ago and he replied that the next release of NEXT.pm would include it, there hasn't been any such release. Oh well…

Write a comment | Bookmark and Share

posted at: 12:09 | path: /dev | permalink | 0 comments | 0 trackbacks

Getopt::Attribute 1.41

I've released Getopt::Attribute 1.41.

It is functionally equivalent to the previous release but has been converted to a better build system (Module::Install) and files are where they should be (with regards to lib/ and t/).

Write a comment | Bookmark and Share

posted at: 11:54 | path: /dev | permalink | 0 comments | 0 trackbacks

Class::Null 1.05

I've released Class::Null 1.05.

It adds overloading, has more tests, better documentation and a better build system (now based on Module::Install).

Write a comment | Bookmark and Share

posted at: 09:57 | path: /dev | permalink | 0 comments | 0 trackbacks

Module::Cloud 0.04

I've released a new module, Module::Cloud.

From the documentation:

This class traverses the given directories, searches for perl code, extracts the modules used by this code and generates a HTML::TagCloud object that gives an impression of how often each module is used.

Thanks to Greg McCarroll for the original idea and code, and for his permission to use them to make this module.

Write a comment | Bookmark and Share

posted at: 16:09 | path: /dev | permalink | 0 comments | 0 trackbacks