NAME
WWW::ShopBot - Price comparison agent
SYNOPSIS
use WWW::ShopBot;
$bot = new WWW::ShopBot( drivers => \@drivers );
$bot->query($product);
DESCRIPTION
This module is a shopping agent which can fetch products' data and sort them by the price. Users can also write drivers to extend its functionality.
Set up a bot
$bot = new WWW::ShopBot(
# Load drivers for merchants
# It will scan through directories for drivers
drivers => \@drivers,
proxy => 'http://foo.bar:1234/,
# Set up account information
login =>
{
driver_1 => {
user => 'abuser',
pass => 'cannot pass',
},
},
# cookie jar
jar => "$ENV{HOME}/.cookies.txt",
);
Look for product
Query will be sent to the given hosts.
$result = $bot->query('some product');
Or more specifically, you can do this.
$result = $bot->query(
product => 'some product',
# Choose items whose prices are between
# an interval
price => [ $lower_bound, $upper_bound ],
# You can use a self-defined filter to
# decide whether to take this item or not.
desc => \&my_desc_filter,
);
Then, it will returns a list of products' data.
List drivers
This module also exports tools for listing existent merchant drivers in computer.
Simply print drivers' names
use WWW::ShopBot qw(list_drivers); print join $/, list_drivers;
Print drivers' names followed by their paths
use WWW::ShopBot qw(list_drivers_paths); print join $/, list_drivers_paths;
CAVEAT
Alpha version.
COPYRIGHT
xern <xern@cpan.org>
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.