# $File: //depot/OurNet-Query/Site.pm $ $Author: autrijus $ # $Revision: #4 $ $Change: 1923 $ $DateTime: 2001/09/28 15:12:04 $ package OurNet::Site; require 5.005; $OurNet::Site::VERSION = '1.55'; use strict; =head1 NAME OurNet::Site - Extract web pages via templates =head1 SYNOPSIS use LWP::Simple; use OurNet::Site; my ($query, $hits) = ('autrijus', 10); my $found; # Create a bot $bot = OurNet::Site->new('google'); # Parse the result got from LWP::Simple $bot->callme($self, 0, get($bot->geturl($query, $hits)), \&callmeback); print '*** ' . ($found ? $found : 'No') . ' match(es) found.'; # Callback routine sub callmeback { my ($self, $himself) = @_; foreach my $entry (@{$himself->{response}}) { if ($entry->{url}) { print "*** [$entry->{title}]" . " ($entry->{score})" . " - [$entry->{id}]\n" . " URL: [$entry->{url}]\n" . " $entry->{preview}\n"; $found++; delete($entry->{url}); } } } =head1 DESCRIPTION This module parses results returned from a typical search engine by reading a 'site descriptor' file defining its aspects, and parses results on-the-fly accordingly. Since v1.52, I uses site descriptors in I