Mohammad S Anwar > LWP-UserAgent-Anonymous-0.04 > LWP::UserAgent::Anonymous

Download:
LWP-UserAgent-Anonymous-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.04   Source   Latest Release: LWP-UserAgent-Anonymous-0.07

NAME ^

LWP::UserAgent::Anonymous - Interface to anonymous LWP::UserAgent.

VERSION ^

Version 0.04

DESCRIPTION ^

It provides an anonymity to a user agent by setting the proxy from the pool of 2329 proxies. It tries to get a valid proxy from the default pool, however,if it can't get hold of any valid after trying $DEFAULT_RETRY_COUNT times, it falls back to non-proxy mode. I have come across quite a few modules available on CPAN that claims to be a frontrunner in this area but unfortunately they all rely on external website that keeps changing with the time and breaking the module in the end.I tried not to rely on the external website for proxy server but capture all the information and keep it locally. Also we have safety net as well just in case nothing works. I promise NOTE: There is no gurantee that you would get anonymous proxy. However there is a very good probability of getting one.

    use strict; use warnings; 
    use LWP::UserAgent::Anonymous;

    my $browser = LWP::UserAgent::Anonymous->new();

METHODS ^

anon_request()

This is simply acts like proxy handler for user agent. It tries to get hold of a valid proxy server, if it can't then it simply takes the standard route. This method behaves exactly as method request() for LWP::UserAgent plus sets the proxy for you. You can get the internal details by switching the debug $LWP::UserAgent::Anonymous::DEBUG.

    use strict; use warnings;
    use LWP::UserAgent::Anonymous;

    my $browser  = LWP::UserAgent::Anonymous->new();
    my $request  = HTTP::Request->new(GET=>'http://www.google.com/');
    my $response = $browser->anon_request($request);

get_proxy()

This returns the proxy that was used last time.

    use strict; use warnings;
    use LWP::UserAgent::Anonymous;

    my $browser  = LWP::UserAgent::Anonymous->new();
    my $request  = HTTP::Request->new(GET=>'http://www.google.com/');
    my $response = $browser->anon_request($request);
    print "Proxy used last time : " . $browser->get_proxy(). "\n";

is_it_ok()

This takes in a proxy and validates it by telneting it. Returns 1 on success and 0 on failure. This is being called by method set_proxy(). Expects the proxy in the format of ddd.ddd.ddd.ddd:ddddd.

    use strict; use warnings;
    use LWP::UserAgent::Anonymous;

    my $browser = LWP::UserAgent::Anonymous->new();
    print "Valid proxy.\n" if $browser->is_it_ok('70.186.168.130:9090');

set_debug()

Turn debug on or off by passing 1 or 0 respectively.

    use strict; use warnings;
    use LWP::UserAgent::Anonymous;

    my $browser = LWP::UserAgent::Anonymous->new();
    $browser->set_debug(1);

set_retry()

Set retry count when fetching proxies. By default the count is 3.

    use strict; use warnings;
    use LWP::UserAgent::Anonymous;

    my $browser = LWP::UserAgent::Anonymous->new();
    $browser->set_retry(2);

set_proxy()

This loads up the default list of proxies and shuffles it before picking up one from the list. This is being called by method anon_request(). This *SHOULD* not be called directly, instead let method anon_request() handle the call for you.

    use strict; use warnings;
    use LWP::UserAgent::Anonymous;

    my $browser = LWP::UserAgent::Anonymous->new();
    $browser->set_proxy();

AUTHOR ^

Mohammad S Anwar, <mohammad.anwar at yahoo.com>

BUGS ^

Please report any bugs or feature requests to bug-lwp-useragent-anonymous at rt.cpan.org,or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LWP-UserAgent-Anonymous. I will be notified and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc LWP::UserAgent::Anonymous

You can also look for information at:

LICENSE AND COPYRIGHT ^

Copyright 2011 Mohammad S Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

DISCLAIMER ^

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: