perldoc > WWW::Search

```html

📛 NAME

WWW::Search - Virtual base class for WWW searches

🚀 Quick Reference

Use CaseCommandDescription
Create a new search objectnew WWW::Search('EngineName')Initialize a backend search engine
Perform a querynative_query($query, \%options)Submit an escaped query with options
Escape a query stringWWW::Search::escape_query($string)URL-encode special characters
Get next resultnext_result()Return next WWW::SearchResult object
Get all resultsresults()Fetch all results (may be slow)
Set HTTP proxyhttp_proxy(['http','ftp'] => 'http://proxy:8080')Configure proxy for firewall
Set cookie jarcookie_jar('/tmp/cookies')Enable cookie persistence
Limit resultsmaximum_to_retrieve(100)Set max hits to return (default 500)
Login to backendlogin($user, $password)Authenticate with search engine
Logoutlogout()End session

📋 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";
    } # while
  $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

🔧 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.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-19 14:14 @216.73.216.42
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^