NAME

Net::Google::Search

SYNOPSIS

use Net::Google::Search;
my $search = Net::Google::Search($service,\%args);

$search->query(qw(aaron cope));
map { print $_->title()."\n"; } @{$search->results()};

DESCRIPTION

Provides a simple OOP-ish interface to the Google SOAP API for searching.

This package is used by Net::Google.

Class Methods

$pkg = Net::Google::Search->new($service,\%args)

Where $service is a valid GoogleSearchService object.

Valid arguments are :

key

String. Google API key. If none is provided then the key passed to the parent Net::Google object will be used.

starts_at

Int. First result number to display. Default is 0.

max_results

Int. Number of results to return. Default is 10.

lr

String or array reference. Language restrictions.

ie

String or array reference. Input encoding.

oe

String or array reference. Output encoding.

safe

Boolean.

filter

Boolean.

$pkg->key($key)

Returns a string.

Returns undef if there was an error.

$pkg->query(@data)

If the first item in @data is empty, then any existing query data will be removed before the new data is added.

Returns a string of words separated by white space. Returns undef if there was an error.

$pkg->starts_at($at)

Returns an int. Default is 0.

Returns undef if there was an error.

$pkg->max_results($max)

The default set by Google is 10 results. However, if you pass a number greater than 10 the results method will make multiple calls to Google API.

Returns an int.

Returns undef if there was an error.

$pkg->restrict(@types)

If the first item in @types is empty, then any existing restrict data will be removed before the new data is added.

Returns a string. Returns undef if there was an error.

$pkg->filter($bool)

Returns true or false. Returns undef if there was an error.

$pkg->safe($bool)

Returns true or false. Returns undef if there was an error.

$pkg->lr(@lang)

Language restriction.

If the first item in @lang is empty, then any existing lr data will be removed before the new data is added.

Returns a string. Returns undef if there was an error.

$pkg->ie(@types)

Input encoding.

If the first item in @types is empty, then any existing ie data will be removed before the new data is added.

Returns a string. Returns undef if there was an error.

$pkg->oe(@types)

Output encoding.

If the first item in @types is empty, then any existing oe data will be removed before the new data is added.

Returns a string. Returns undef if there was an error.

$pkg->results()

Returns an array ref of Result objects.

Private Methods

$pkg->_results($first,$count)

Result Methods

$result->title()

Returns a string.

$result->URL()

Returns a string.

$result->snippet()

Returns a string, formatted in HTML.

$result->cachedSize()

Returns a string.

$result->directoryTitle()

Returns a string.

$result->summary()

Returns a string.

$result->hostName()

Returns a string.

$result->directoryCategory()

Returns a hash reference.

VERSION

0.2.1

DATE

April 14, 2002

AUTHOR

Aaron Straup Cope

TO DO

  • Add hooks to manage boolean searches and speacial query strings.

SEE ALSO

Net::Google

LICENSE

Copyright (c) 2002, Aaron Straup Cope. All Rights Reserved.

This is free software, you may use it and distribute it under the same terms as Perl itself.