#!/usr/bin/perl use strict; use warnings; use Web::Scraper::Config; use IO::All; use YAML::Syck; use Data::Dumper; use URI; use utf8; $YAML::Syck::ImplicitUnicode = 1; my $contents; my $key = 'hatena'; io('/usr/local/apache/sexnotes.org/conf/sex_recorder_catalyst_openid_hack.yml') > $contents; my $a = Load( $contents ); $a = $a->{openid_hack}; my $scraper = Web::Scraper::Config->new( $a->{$key}{conf}, { callbacks => { decode_hatena_email => sub { my $elem = shift; my $html = $elem->as_HTML(); $html =~ s/\'\s*\+\s*\'//g; require HTML::Entities; my $decoded = HTML::Entities::decode($html); my $text = ($decoded =~ m!href=".+?">(.*?)!s)[0]; return $text; } } } ); my $res = $scraper->scrape(URI->new( $a->{$key}{url} ) ); warn Dumper $res;