Mail-IMAPTalk

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

        The hostname or IP address to connect to. This must be supplied unless
        the **Socket** option is supplied.

    - **Port**

        The port number on the host to connect to. Defaults to 143 if not supplied
        or 993 if not supplied and UseSSL is true.

    - **UseSSL**

        If true, use an IO::Socket::SSL connection. All other SSL\_\* arguments
        are passed to the IO::Socket::SSL constructor.

    - **Socket**

        An existing socket to use as the connection to the IMAP server. If you
        supply the **Socket** option, you should not supply a **Server** or **Port**
        option.

        This is useful if you want to create an SSL socket connection using
        IO::Socket::SSL and then pass in the connected socket to the new() call.

        It's also useful in conjunction with the `release_socket()` method
        described below for reusing the same socket beyond the lifetime of the IMAPTalk
        object. See a description in the section `release_socket()` method for
        more information.

        You must have write flushing enabled for any
        socket you pass in here so that commands will actually be sent,
        and responses received, rather than just waiting and eventually
        timing out. you can do this using the Perl `select()` call and

lib/Mail/IMAPTalk.pm  view on Meta::CPAN

The hostname or IP address to connect to. This must be supplied unless
the B<Socket> option is supplied.

=item B<Port>

The port number on the host to connect to. Defaults to 143 if not supplied
or 993 if not supplied and UseSSL is true.

=item B<UseSSL>

If true, use an IO::Socket::SSL connection. All other SSL_* arguments
are passed to the IO::Socket::SSL constructor.

=item B<Socket>

An existing socket to use as the connection to the IMAP server. If you
supply the B<Socket> option, you should not supply a B<Server> or B<Port>
option.

This is useful if you want to create an SSL socket connection using
IO::Socket::SSL and then pass in the connected socket to the new() call.

It's also useful in conjunction with the C<release_socket()> method
described below for reusing the same socket beyond the lifetime of the IMAPTalk
object. See a description in the section C<release_socket()> method for
more information.

You must have write flushing enabled for any
socket you pass in here so that commands will actually be sent,
and responses received, rather than just waiting and eventually
timing out. you can do this using the Perl C<select()> call and

lib/Mail/IMAPTalk.pm  view on Meta::CPAN


    # Set starting state
    $Self->state(Unconnected);

    my %SocketOpts;
    my $DefaultPort = 143;
    my $SocketClass = $DefSocketClass;

    if (my $SSLOpt = $Args{UseSSL}) {
      $SSLOpt = $SSLOpt eq '1' ? '' : " qw($SSLOpt)";
      eval "use IO::Socket::SSL$SSLOpt; 1;" || return undef;
      $SocketClass = "IO::Socket::SSL";
      $DefaultPort = 993;
      $SocketOpts{$_} = $Args{$_} for grep { /^SSL_/ } keys %Args;
    }

    $SocketOpts{PeerHost} = $Self->{Server} = $Args{Server} || die "No Server name given";
    $SocketOpts{PeerPort} = $Self->{Port} = $Args{Port} || $DefaultPort;

    $Socket = ($Args{NewSocketCB} || sub { shift->new(@_) })->($SocketClass, %SocketOpts) || return undef;

    # Force flushing after every write to the socket



( run in 0.475 second using v1.01-cache-2.11-cpan-4d50c553e7e )