The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTTP::ProxySelector - Perl extension for automatically setting an anonymous proxy

SYNOPSIS

  use HTTP::ProxySelector;
  use LWP::UserAgent;

  # Instanciate
  my $selector = HTTP::ProxySelector->new();
  my $ua = LWP::UserAgent->new();

  # Assign an anonymous proxy to the UserAgent object.
  $selector->set_proxy($ua);
  
  # Just in case you need to know the chosen proxy
  print 'Selected proxy: ',$selector->get_proxy(),"\n";

DESCRIPTION

Automatically selects you an anonymous proxy for use of your UserAgent instance. Just hand it your favorite proxy list site, or use the defaults. The package will then use your existing useragent instance to access the site and set it's proxy settings according to a random entry in the list.

METHODS

new - Constructor $select = HTTP::ProxySelector->new();

new is the constructor for HTTP::ProxySelector objects

Arguments:

- Accepts an Key-Value list with the list attributes.

General

  Key: sites     - Reference to a list of sites containing the proxy lists.
                   Example : $select = HTTP::ProxySelector->new(sites =>
                                                             ['http://www.proxylist.com/list.htm']);
                                   Default - http://www.multiproxy.org/txt_anon/proxy.txt
                                             http://www.samair.ru/proxy/fresh-proxy-list.htm

Proxy testing

  Key: testflag  - Flag indicating whether the randomly selected proxy should be checked.
                   Example : $select = HTTP::ProxySelector->new(testflag => 0);
                                   Default - 1.

           num_tries - Number of proxies you wish to test before giving up.
                   Example : $select = HTTP::ProxySelector->new(num_tries => 10);
                                   Default - 5.

           testsite  - Destination site to test the proxy with.
                   Example : $select = HTTP::ProxySelector->new(testsite => 'http://yahoo.com');
                                   Default - http://www.google.com
set_proxy - Assign anonymous proxy
  $result = $select->set_proxy($useragent);
          

Assign anonymous proxy to the useragent proxy

Arguments:

 LWP::UserAgent object.

Return value:

0 on success, a string describing the error upon failure

get_proxy - Get selected proxy information
  $proxy = $select->get_proxy();
          

Extract the address of the currently selected proxy.

Arguments:

None.

Return value:

String, describing the address of the proxy.

EXPORT

None by default.

TODO

This is becoming a dangerous habbit, but testing should really be implemented sometime soon.

AUTHOR

Eyal Udassin, <eyal@cpan.org>

SEE ALSO

perl, LWP::UserAgent.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 187:

You forgot a '=back' before '=head1'