#!/usr/bin/perl # $File: //depot/OurNet-Query/bin/sitequery $ $Author: autrijus $ # $Revision: #3 $ $Change: 1923 $ $DateTime: 2001/09/28 15:12:04 $ $VERSION = '0.03'; $REVISION = "rev$1\[\@$2\]" if ('$Revision: #3 $ $Change: 1923 $' =~ /(\d+)[^\d]+(\d+)/); =head1 NAME sitequery - Query multiple sites in parallel =head1 SYNOPSIS B S<[ I I... ]> I =head1 DESCRIPTION This script queries the specified sites (defaults to google) for a given query string. To see it in action, try this: % sitequery perl =cut use strict; use OurNet::Query; my %found; unless (@ARGV) { die << "."; Site Query v$main::VERSION-$main::REVISION Usage: $0 [site1 site2...] Copyright 2001 by Autrijus Tang . This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See . . } exec('perldoc', $0) if $ARGV[0] eq '-h'; my $query = OurNet::Query->new(pop(@ARGV), 10, @ARGV ? @ARGV : 'google'); $query->begin(\&callback, 30); # Timeout after 30 seconds sub callback { local $^W; my %entry = @_; my $entry = \%entry; unless ($found{$entry{url}}++) { print "[$entry->{title}]\n=> $entry->{url}\n"; } } __END__ =head1 SEE ALSO L, L =head1 AUTHORS Autrijus Tang Eautrijus@autrijus.org> =head1 COPYRIGHT Copyright 2001 by Autrijus Tang Eautrijus@autrijus.org>. All rights reserved. You can redistribute and/or modify this module under the same terms as Perl itself. =cut