The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OurNet::Query - Perform scriptable queries via LWP

SYNOPSIS

use OurNet::Query;

# Set query parameters
my ($query, $hits) = ('autrijus', 10);
my @sites = ('Altavista', 'InfoSeek', 'Yahoo', 'Excite');
my %found;

# Generate a new Query object
my $bot = OurNet::Query->new($query, $hits, @sites);

# Perform a query
my $found = $bot->begin(\&callback, 30); # Timeout after 30 seconds

print '*** ' . ($found ? $found : 'No') . ' match(es) found.';

sub callback {
    my %entry = @_;
    my $entry = \%entry;

    unless ($found{$entry{'url'}}) {
        print "*** [$entry->{'title'}]" .
                 " ($entry->{'score'})" .
               " - [$entry->{'id'}]\n"  .
         "    URL: [$entry->{'url'}]\n";
    }

    $found{$entry{'url'}}++;
}

DESCRIPTION

OurNet::Query provides an easy interface to perform multiple queries to internet services, and "wrap" them into your own format at once. The results are processed on-the-fly and are returned via callback functions.

SEE ALSO

OurNet::Site

AUTHORS

Autrijus Tang <autrijus@autrijus.org>

COPYRIGHT

Copyright 2001 by Autrijus Tang <autrijus@autrijus.org>.

All rights reserved. You can redistribute and/or modify this module under the same terms as Perl itself.