perldoc > WWW::Search

📛 NAME

WWW::Search - Virtual base class for WWW searches

🚀 Quick Reference

Use CaseCommandDescription
Create search object$oSearch = new WWW::Search('AltaVista');Instantiate a search engine backend
Perform query$oSearch->native_query(WWW::Search::escape_query($sQuery));Set up a query with escaped string and optional options
Iterate resultswhile (my $oResult = $oSearch->next_result()) { print $oResult->url; }Retrieve results one by one
Get all results at once@results = $oSearch->results();Return all results as an array (may block)
Set proxy$oSearch->env_proxy('yes');Use environment variables for proxy
Use cookie jar$oSearch->cookie_jar('/tmp/cookies');Persist cookies across requests
Limit results$oSearch->maximum_to_retrieve(100);Set maximum number of hits to fetch
Escape query$escaped = WWW::Search::escape_query('+hi +mom');Convert special characters for URL

📖 SYNOPSIS

use WWW::Search;
my $sEngine = 'AltaVista';
my $oSearch = new WWW::Search($sEngine);

📝 DESCRIPTION

This class is the parent for all access methods supported by the WWW::Search library. This library implements a Perl API to web-based search engines.

See README for a list of search engines currently supported, and for a lot of interesting high-level information about this distribution.

Search results can be limited, and there is a pause between each request to avoid overloading either the client or the server.

🔍 Sample program

my $sQuery = 'Columbus Ohio sushi restaurant';
my $oSearch = new WWW::Search('AltaVista');
$oSearch->native_query(WWW::Search::escape_query($sQuery));
$oSearch->login($sUser, $sPassword);
while (my $oResult = $oSearch->next_result()) {
    print $oResult->url, "\n";
}
$oSearch->logout;

Results are objects of type WWW::SearchResult (see WWW::SearchResult for details). Note that different backends support different result fields. All backends are required to support title and url.

👀 SEE ALSO

For specific search engines, see WWW::Search::TheEngineName (replacing TheEngineName with a particular search engine).

For details about the results of a search, see WWW::SearchResult.

🔧 METHODS AND FUNCTIONS FOR SEARCHERS

đŸ› ī¸ METHODS AND FUNCTIONS FOR BACKEND PROGRAMMERS

🚀 IMPLEMENTING NEW BACKENDS

WWW::Search supports backends to separate search engines. Each backend is implemented as a subclass of WWW::Search. WWW::Search::Yahoo provides a good sample backend.

A backend must have the routine _native_setup_search(). A backend must have the routine _native_retrieve_some() or _parse_tree().

_native_setup_search() is invoked before the search. It is passed a single argument: the escaped, native version of the query.

_native_retrieve_some() is the core of a backend. It will be called periodically to fetch URLs. It should retrieve several hits from the search service and add them to the cache. It should return the number of hits found, or undef when there are no more hits.

Internally, _native_retrieve_some() typically sends an HTTP request to the search service, parses the HTML, extracts the links and descriptions, then saves the URL for the next page of results. See the code for the WWW::Search::AltaVista module for an example.

Alternatively, a backend can define the method _parse_tree() instead of _native_retrieve_some(). See the WWW::Search::Ebay module for a good example.

If you implement a new backend, please let the authors know.

🐛 BUGS AND DESIRED FEATURES

The bugs are there for you to find (some people call them Easter Eggs).

Desired features:

âœī¸ AUTHOR

John Heidemann <johnh AT isi.edu> Maintained by Martin Thurn, "mthurn AT cpan.org", <http://www.sandcrawler.com/SWB/cpan-modules.html>.

ÂŠī¸ COPYRIGHT

Copyright (c) 1996 University of Southern California. All rights reserved.

Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed by the University of Southern California, Information Sciences Institute. The name of the University may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

WWW::Search
📛 NAME 🚀 Quick Reference 📖 SYNOPSIS 📝 DESCRIPTION
🔍 Sample program
👀 SEE ALSO 🔧 METHODS AND FUNCTIONS FOR SEARCHERS đŸ› ī¸ METHODS AND FUNCTIONS FOR BACKEND PROGRAMMERS 🚀 IMPLEMENTING NEW BACKENDS 🐛 BUGS AND DESIRED FEATURES âœī¸ AUTHOR ÂŠī¸ COPYRIGHT

Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 04:16 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^