Skip Menu |
 

This queue is for tickets about the IO-Socket-SSL CPAN distribution.

Report information
The Basics
Id: 84574
Status: resolved
Priority: 0/
Queue: IO-Socket-SSL

People
Owner: Nobody in particular
Requestors: FRAZER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 1.76
  • 1.84
Fixed in: (no value)



Subject: $^S ($EXCEPTIONS_BEING_CAUGHT) not being set when Socket, Socket6, IO::Socket::IP, or IO::Socket::INET6 fail to load in eval
Download (untitled) / with headers
text/plain 1.1k
When the evals in the BEGIN block that checks for $ip6 fail, it is not setting the $^S variable indicating that the exception was caught in an eval. Here is an example one-liner showing the issue: Show quoted text
> perl -Ilib/ -le '$SIG{__DIE__} = sub { print qq{Err: $_[0]\$^S: $^S}; }; require IO::Socket::SSL;'
Err: Can't locate object method "tid" via package "threads" at /usr/local/perl-5.14.2/lib/XSLoader.pm line 95. $^S: 1 Err: Socket version 1.95 required--this is only version 1.94 at lib//IO/Socket/SSL.pm line 92. $^S: Err: Can't locate IO/Socket/IP.pm in @INC (@INC contains: lib/ /usr/local/perl-5.14.2/site/lib /usr/local/perl-5.14.2/lib /ublocal/lib/perl5/lib/perl5/sun4-solaris-thread-multi-64 /ublocal/lib/perl5/lib/perl5/sun4-solaris-thread-multi /ublocal/lib/perl5/lib/perl5 /ublocal/lib/perl .) at lib//IO/Socket/SSL.pm line 106. $^S: The first error shown is from Net::SSLeay (v1.48) and seems to be trapped properly, but the others are from IO::Socket::SSL and don't have the $^S value set properly. This causes problems with my custom error handler because I can't tell that the error was trapped and can be ignored. I am using Perl 5.14.2 on Solaris 10.
Download (untitled) / with headers
text/plain 1.6k
Hi, the problem seems to be, that eval inside BEGIN blocks does not set $^S. But I need to put the code inside a BEGIN block, because it needs to import constants which are later used inside the program. So there is not much I can do about it. You might check the different behavior with the following: BEGIN { eval { die "foo" }} vs. eval { die "foo" }} Am Do 11. Apr 2013, 08:44:34, FRAZER schrieb: Show quoted text
> When the evals in the BEGIN block that checks for $ip6 fail, it is not > setting the $^S variable indicating that the exception was caught > in an eval. > > Here is an example one-liner showing the issue:
> > perl -Ilib/ -le '$SIG{__DIE__} = sub { print qq{Err: $_[0]\$^S:
> $^S}; }; require IO::Socket::SSL;' > Err: Can't locate object method "tid" via package "threads" at > /usr/local/perl-5.14.2/lib/XSLoader.pm line 95. > $^S: 1 > Err: Socket version 1.95 required--this is only version 1.94 at > lib//IO/Socket/SSL.pm line 92. > $^S: > Err: Can't locate IO/Socket/IP.pm in @INC (@INC contains: lib/ > /usr/local/perl-5.14.2/site/lib /usr/local/perl-5.14.2/lib > /ublocal/lib/perl5/lib/perl5/sun4-solaris-thread-multi-64 > /ublocal/lib/perl5/lib/perl5/sun4-solaris-thread-multi > /ublocal/lib/perl5/lib/perl5 /ublocal/lib/perl .) at > lib//IO/Socket/SSL.pm line 106. > $^S: > > The first error shown is from Net::SSLeay (v1.48) and seems to be > trapped properly, but the others are from IO::Socket::SSL and don't > have the $^S value set properly. This causes problems with my > custom error handler because I can't tell that the error was > trapped and can be ignored. > > I am using Perl 5.14.2 on Solaris 10.
Download (untitled) / with headers
text/plain 1.8k
That makes sense. Is there any reason why you localize $SIG{__DIE__} in the other BEGIN blocks, but not this one? On Thu Apr 11 12:18:45 2013, SULLR wrote: Show quoted text
> Hi, > the problem seems to be, that eval inside BEGIN blocks does not set > $^S. > But I need to put the code inside a BEGIN block, because it needs to > import constants which are later used inside the program. > So there is not much I can do about it. > > You might check the different behavior with the following: > > BEGIN { eval { die "foo" }} > vs. eval { die "foo" }} > > > > Am Do 11. Apr 2013, 08:44:34, FRAZER schrieb:
> > When the evals in the BEGIN block that checks for $ip6 fail, it is
> not
> > setting the $^S variable indicating that the exception was caught > > in an eval. > > > > Here is an example one-liner showing the issue:
> > > perl -Ilib/ -le '$SIG{__DIE__} = sub { print qq{Err: $_[0]\$^S:
> > $^S}; }; require IO::Socket::SSL;' > > Err: Can't locate object method "tid" via package "threads" at > > /usr/local/perl-5.14.2/lib/XSLoader.pm line 95. > > $^S: 1 > > Err: Socket version 1.95 required--this is only version 1.94 at > > lib//IO/Socket/SSL.pm line 92. > > $^S: > > Err: Can't locate IO/Socket/IP.pm in @INC (@INC contains: lib/ > > /usr/local/perl-5.14.2/site/lib /usr/local/perl-5.14.2/lib > > /ublocal/lib/perl5/lib/perl5/sun4-solaris-thread-multi-64 > > /ublocal/lib/perl5/lib/perl5/sun4-solaris-thread-multi > > /ublocal/lib/perl5/lib/perl5 /ublocal/lib/perl .) at > > lib//IO/Socket/SSL.pm line 106. > > $^S: > > > > The first error shown is from Net::SSLeay (v1.48) and seems to be > > trapped properly, but the others are from IO::Socket::SSL and
> don't
> > have the $^S value set properly. This causes problems with my > > custom error handler because I can't tell that the error was > > trapped and can be ignored. > > > > I am using Perl 5.14.2 on Solaris 10.
>
Download (untitled) / with headers
text/plain 323b
Am Do 11. Apr 2013, 12:52:46, FRAZER schrieb: Show quoted text
> That makes sense. Is there any reason why you localize $SIG{__DIE__} > in the other BEGIN blocks, but not this one?
there is no reason I can think of, so I just added local __DIE__ handlers for all probing of modules. Thus the bug should be fixed with 1.85. Thanks, Steffen


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.