Coro::PatchSet::Socket - fix Coro::Socket as much as possible
use Coro::PatchSet::Socket; # or # use Coro::PatchSet 'socket'; use Coro; async { ... }
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
io_socket_timeout
Timeout
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
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
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
... or croak
new Coro::Socket
Coro::PatchSet
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.
To install Coro::PatchSet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Coro::PatchSet
CPAN shell
perl -MCPAN -e shell install Coro::PatchSet
For more information on module installation, please visit the detailed CPAN module installation guide.