The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Coro::PatchSet::Socket - fix Coro::Socket as much as possible

SYNOPSIS

    use Coro::PatchSet::Socket;
    # or
    # use Coro::PatchSet 'socket';
    use Coro;
    
    async { ... }

PATCHES

timeout

In the current Coro::Socket implementation internal io_socket_timeout variable is not defined. But this variable exists in the IO::Socket::INET objects, which Coro::Socket tries to emulate. And many modules relies on the value of this variable. One of this is LWP::UserAgent, so without this variable timeout in the LWP requests will not work. This patch defines this variable with the value specified in the Timeout constructor option. See t/03_socket_timeout.t

connect

In the current Coro::Socket implementation Coro::Socket->new(PeerAddr => $a, PeerPort => $p) always returns Coro::Socket object, even if connection was not successfull. But in fact it should return undef if fail occured. So, after this patch Coro::Socket constructor will always return proper value. See t/04_socket_connect.t

inheritance

In the current Coro::Socket implementation Coro::Socket handles PeerAddr argument in the constructor. This is not compatible with IO::Socket::INET implementation where all arguments handled inside configure(). Because of this some classes inherited from Coro::Socket which defines PeerAddr only inside configure() may not work. See t/06_socket_inherit.t

return instead of croak

Coro::Socket has many ... or croak statements. And your new Coro::Socket may die when it should return false. For example when it will not be able to resolve host it will die instead of return false. This is not how IO::Socket::INET works. So, this patch will change the behavior to expected. See t/10_bad_host_name_no_croak.t

SEE ALSO

Coro::PatchSet

COPYRIGHT

Copyright 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.