IO::Socket::Socks::Wrapped - object wrapped by IO::Socket::Socks::Wrapper
use WWW::Mechanize; use IO::Socket::Socks::Wrapped; my $ua = WWW::Mechanize->new; my $s_ua = IO::Socket::Socks::Wrapped->new($ua, { ProxyAddr => 'localhost', ProxyPort => 1080 }); $s_ua->get("http://google.com"); # via proxy $ua->get("http://google.com"); # direct $s_ua->isa('WWW::Mechanize'); # true $s_ua->can('is_html'); # true print ref($s_ua); # IO::Socket::Socks::Wrapped
IO::Socket::Socks::Wrapped is representation of object wrapped by IO::Socket::Socks::Wrapper. You may create it directly by new() method or through IO::Socket::Socks::Wrapper::wrap_connection() subroutine. First parameter is original object, that internally uses IO::Socket for creation of tcp connections. Second is proxy configuration (see IO::Socket::Socks::Wrapper documentation). New IO::Socket::Socks::Wrapped object will use proxy specified in configuration for tcp connections. Original object also may be used, but it will make direct tcp connections. In fact new object uses original internally and has all it methods. So if you'll change some behaviour of original object, behaviour of wrapped object also will be changed.
IO::Socket::Socks::Wrapped
IO::Socket::Socks::Wrapper
You can access original object this way:
my $orig = $wrapped_object->{orig};
Wrapped object behaviour for UNIVERSAL methods (isa, can, DOES) is same as original object behaviour. So, the following is true
$wrapped_object->isa('Original::Package');
Oleg G <oleg@cpan.org>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install IO::Socket::Socks::Wrapper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IO::Socket::Socks::Wrapper
CPAN shell
perl -MCPAN -e shell install IO::Socket::Socks::Wrapper
For more information on module installation, please visit the detailed CPAN module installation guide.