Codebase list libpoe-component-sslify-perl / df843cf
fix warning in PoCo-Client/Server-TCP, thanks HMBRAND Apocalypse 14 years ago
7 changed file(s) with 53 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
00 Revision history for Perl extension POE::Component::SSLify.
1
2 * 0.19
3
4 Fixed a warning generated by POE::Component::Client::TCP in t/simple.t, thanks HMBRAND!
15
26 * 0.18
37
22
33 # Initialize our version
44 use vars qw( $VERSION );
5 $VERSION = '0.18';
5 $VERSION = '0.19';
66
77 # Import the SSL death routines
88 use Net::SSLeay qw( die_now die_if_ssl_error );
22
33 # Initialize our version
44 use vars qw( $VERSION );
5 $VERSION = '0.18';
5 $VERSION = '0.19';
66
77 # Import the SSL death routines
88 use Net::SSLeay qw( die_now die_if_ssl_error );
22
33 # Initialize our version
44 use vars qw( $VERSION );
5 $VERSION = '0.18';
5 $VERSION = '0.19';
66
77 # We need Net::SSLeay or all's a failure!
88 BEGIN {
5757 # Perl 5.005_03 doesn't like blocking(), so we only use it in
5858 # 5.8.0 and beyond.
5959 if ( $] >= 5.008 and $^O eq 'MSWin32' ) {
60 # TODO investigate this?
61 # <kmx> kthakore: Apocalypse: FYI - as regards no-blocking socket dark magic commited to FB while ago - IO::Socket 1.24 (=May/2009) and later supports on Win32 simply $socket->blocking(0);
62 # <Apocalypse> kmx: Ah didn't know that - maybe I can use that :)
63 # <kmx> Apocalypse: I uderstand that used workaround is from pre IO::Socket 1.24 times
64 # <Apocalypse> Ah, my code already did that eh
65 # <Apocalypse> if ( $] >= 5.008 and $^O eq 'MSWin32' ) {
66 # <Apocalypse> But maybe 5.008 check isn't enough?
67 # <kmx> Apocalypse: You'd better check version of IO - see changelog http://cpansearch.perl.org/src/GBARR/IO-1.25/ChangeLog
68 # <Apocalypse> Hmm yeah
69 # <Apocalypse> * Make non-blocking mode work on Windows in IO::Socket::INET
70 # <kmx> Apocalypse: exactly
71 # <Apocalypse> Thanks for the tip! I'll go and add a TODO to the sslify code to investigate that :)
72
73
6074 # From IO::Handle POD
6175 # If an error occurs blocking will return undef and $! will be set.
6276 if ( ! $socket->blocking( 0 ) ) {
11 use strict; use warnings;
22
33 use Test::More;
4 eval "use Test::Apocalypse";
4 eval "use Test::Apocalypse 0.10";
55 if ( $@ ) {
66 plan skip_all => 'Test::Apocalypse required for validating the distribution';
77 } else {
88 # lousy hack for kwalitee
99 require Test::NoWarnings; require Test::Pod; require Test::Pod::Coverage;
10 is_apocalypse_here( {
11 deny => qr/^(?:(?:OutdatedPrereq|Dependencie)s|ModuleUsed|Strict|Fixme|Pod_Spelling)$/,
12 } );
10 is_apocalypse_here();
1311 }
8282 $heap->{client}->put("pong2");
8383 }
8484 },
85 ClientError => sub
86 {
87 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
88 # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
89 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
90
91 # TODO are there other "errors" that is harmless?
92 $error = "Normal disconnection" unless $error;
93 my $msg = "Got SERVER $syscall error $errno: $error";
94 unless ( $syscall eq 'read' and $errno == 0 ) {
95 fail( $msg );
96 } else {
97 diag( $msg );
98 }
99 },
85100 );
86101
87102 POE::Component::Client::TCP->new
147162 $kernel->yield('shutdown');
148163 }
149164 },
165 ServerError => sub
166 {
167 # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0!
168 # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
169 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
170
171 # TODO are there other "errors" that is harmless?
172 $error = "Normal disconnection" unless $error;
173 my $msg = "Got CLIENT $syscall error $errno: $error";
174 unless ( $syscall eq 'read' and $errno == 0 ) {
175 fail( $msg );
176 } else {
177 diag( $msg );
178 }
179 },
150180 );
151181
152182 $poe_kernel->run();