Zoffix Znet > WWW-Proxy4FreeCom > WWW::Proxy4FreeCom



Annotate this POD


View/Report Bugs
Module Version: 1.004002   Source  


WWW::Proxy4FreeCom - fetch proxy list from http://proxy4free.com/


    use strict;
    use warnings;
    use WWW::Proxy4FreeCom;

    my $prox = WWW::Proxy4FreeCom->new;

    my $proxies = $prox->get_list
        or die $prox->error;

    printf "%-40s (last tested %s ago)\n", @$_{ qw(domain last_test) }
        for @$proxies;


The module provides means to fetch proxy list from http://proxy4free.com/ website.



    my $prox = WWW::Proxy4FreeCom->new;

    my $prox = WWW::Proxy4FreeCom->new(
        timeout => 10,
        debug   => 1,

    my $prox = WWW::Proxy4FreeCom->new(
        ua => LWP::UserAgent->new(
            timeout => 10,
            agent   => 'ProxUA',

Constructs and returns a brand new yummy juicy WWW::Proxy4FreeCom object. Takes a few optional arguments. Possible arguments are as follows:


    ->new( timeout => 10 );

Optional. Specifies the timeout argument of LWP::UserAgent's constructor, which is used for retrieving data. Defaults to: 30 seconds.


    ->new( ua => LWP::UserAgent->new(agent => 'Foos!') );

Optional. If the timeout argument is not enough for your needs of mutilating the LWP::UserAgent object used for retrieving proxy list, feel free to specify the ua argument which takes an LWP::UserAgent object as a value. Note: the timeout argument to the constructor will not do anything if you specify the ua argument as well. Defaults to: plain boring default LWP::UserAgent object with timeout argument set to whatever WWW::Proxy4FreeCom's timeout argument is set to as well as agent argument is set to mimic Firefox.


    ->new( debug => 1 );

When get_list() is called any unsuccessful page retrievals will be silently ignored. Setting debug argument to a true value will carp() any network errors if they occur.



    my $list_ref = $prox->get_list # just from the "proxy list 1"
        or die $prox->error;

    my $list_ref = $prox->get_list( 2 ) # just from the "proxy list 2"
        or die $prox->error;

    $prox->get_list( [3,5] ) # lists 3 and 5 only
        or die $prox->error;

Instructs the objects to fetch a fresh list of proxies from http://proxy4free.com/. On failure returns undef or an empty list, depending on the context, and the human-readable error will be available by calling the ->error method. On success returns an arrayref of hashrefs, each representing a proxy entry. Takes one optional argument which can be either a number between 1 and 14 (inclusive) or an arrayref with several of these numbers. The numbers represent the page number of proxy list pages on http://proxy4free.com/. By default only the list from the "proxy list 1" will be fetched.

Each hashref in the returned arrayref is in a following format (if any field is missing on the site it will be reported as a string N/A):

        'domain' => 'localfast.info',
        'rating' => '65',
        'country' => 'Germany',
        'access_time' => '1.3',
        'uptime' => '96',
        'online_since' => '16 hours',
        'last_test' => '30 minutes',
        'features_hian' => '1',
        'features_ssl' => '0',

Where all the values correspond to the proxy list table columns on the website. The features_hian and features_ssl keys will be set to true values, if the proxy offers HiAn or SSL features respectively.


    my $list = $prox->get_list # just from the "proxy list 1"
        or die $prox->error;

If get_list() method fails it will return either undef or an empty list, depending on the context, and the reason for the error will be available via error() method. Takes no arguments, return a human-readable error message explaining the failure.


    my $last_list_ref = $prox->list;

Contains cached value returned from most recent get_list() call. In other words, this method should be called after a successful response from get_list(). Takes no arguments, returns the same arrayref of hashrefs structure as get_list().


    my $old_LWP_UA_obj = $prox->ua;

    $prox->ua( LWP::UserAgent->new( timeout => 10, agent => 'foos' );

Returns a currently used LWP::UserAgent object used for retrieving data. Takes one optional argument which must be an LWP::UserAgent object, and the object you specify will be used in any subsequent calls to get_list().


    my $old_debug => $prox->debug;


Returns a currently set debug value, when called with an optional argument (which can be either a true or false value) will set debug to that value. See debug argument to constructor for more information.


Fork this module on GitHub: https://github.com/zoffixznet/WWW-Proxy4FreeCom


To report bugs or request features, please use https://github.com/zoffixznet/WWW-Proxy4FreeCom/issues

If you can't access GitHub, you can email your request to bug-www-proxy4freecom at rt.cpan.org



You can use and distribute this module under the same terms as Perl itself. See the LICENSE file included in this distribution for complete details.

syntax highlighting: