diff options
Diffstat (limited to 'lib/Net/POP3.pm')
-rw-r--r-- | lib/Net/POP3.pm | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/lib/Net/POP3.pm b/lib/Net/POP3.pm index 7a371d3..b523348 100644 --- a/lib/Net/POP3.pm +++ b/lib/Net/POP3.pm @@ -34,16 +34,19 @@ my $nossl_warn = !$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'; # Code for detecting if we can use IPv6 +my $family_key = 'Domain'; my $inet6_class = eval { require IO::Socket::IP; no warnings 'numeric'; - IO::Socket::IP->VERSION(0.20); + IO::Socket::IP->VERSION(0.20) || die; + $family_key = 'Family'; } && 'IO::Socket::IP' || eval { require IO::Socket::INET6; no warnings 'numeric'; IO::Socket::INET6->VERSION(2.62); } && 'IO::Socket::INET6'; + sub can_ssl { $ssl_class }; sub can_inet6 { $inet6_class }; @@ -63,7 +66,6 @@ sub new { } my $hosts = defined $host ? [$host] : $NetConfig{pop3_hosts}; my $obj; - my @localport = exists $arg{ResvPort} ? (LocalPort => $arg{ResvPort}) : (); if ($arg{SSL}) { # SSL from start @@ -78,7 +80,9 @@ sub new { PeerAddr => ($host = $h), PeerPort => $arg{Port} || 'pop3(110)', Proto => 'tcp', - @localport, + $family_key => $arg{Domain} || $arg{Family}, + LocalAddr => $arg{LocalAddr}, + LocalPort => exists($arg{ResvPort}) ? $arg{ResvPort} : $arg{LocalPort}, Timeout => $arg{Timeout}, ) and last; @@ -623,12 +627,16 @@ Net::POP3 - Post Office Protocol 3 Client class (RFC1939) This module implements a client interface to the POP3 protocol, enabling a perl5 application to talk to POP3 servers. This documentation assumes that you are familiar with the POP3 protocol described in RFC1939. +With L<IO::Socket::SSL> installed it also provides support for implicit and +explicit TLS encryption, i.e. POP3S or POP3+STLS. A new Net::POP3 object must be created with the I<new> method. Once this has been done, all POP3 commands are accessed via method calls on the object. -The Net::POP3 class is a subclass of Net::Cmd and IO::Socket::INET. +The Net::POP3 class is a subclass of Net::Cmd and (depending on avaibility) of +IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET. + =head1 CONSTRUCTOR @@ -659,9 +667,14 @@ upgrade with C<starttls>. You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will usually use the right arguments already. -B<ResvPort> - If given then the socket for the C<Net::POP3> object -will be bound to the local port given using C<bind> when the socket is -created. +B<LocalAddr> and B<LocalPort> - These parameters are passed directly +to IO::Socket to allow binding the socket to a a specific local addr and port. +For compatibility with older versions B<ResvPort> can be used instead of +B<LocalPort>. + +B<Domain> - This parameter is passed directly to IO::Socket and makes it +possible to enforce IPv4 connections even if L<IO::Socket::IP> is used as super +class. Alternatively B<Family> can be used. B<Timeout> - Maximum time, in seconds, to wait for a response from the POP3 server (default: 120) |