Skip to content

Instantly share code, notes, and snippets.

@hidek
Created June 8, 2009 05:48
Show Gist options
  • Select an option

  • Save hidek/125650 to your computer and use it in GitHub Desktop.

Select an option

Save hidek/125650 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Web::Scraper;
use URI;
use Data::Dumper;
my $s = scraper {
process '//p', 'foo[]' => sub {return {foo => 'bar', hoge => 'huga'}};
result qw/foo/;
};
my $res = $s->scrape(URI->new("http://localhost/~hide/hoge.html"));
warn Dumper $res;
---
<html>
<p>a</p>
<p>b</p>
</html>
---
$VAR1 = [
{
'foo' => 'bar',
'hoge' => 'huga'
},
{
'foo' => 'bar',
'hoge' => 'huga'
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment