Skip Menu |

This queue is for tickets about the Error CPAN distribution.

Report information
The Basics
Id: 24218
Status: resolved
Priority: 0/
Queue: Error

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

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Empty exception issue
Hello, Attached please find a tiny reproduction case for behavior that is contrary to my expectation. In short, within a try, after a call to the constructor of a particular module, any calls to die will end up triggering exception handling (correctly) but the argument to die is not being propagated (not my expectation). Instead, I receive an "empty exception" showing up as literally " at /path/to/Error.pm line 38." Needless to say, this can be a particularly troublesome issue within a large system as it effectively masks a "real error message" thus making debugging far more time-consuming. I'm not sure if this is a bug in Error or Spreadsheet::WriteExcel or even if my expectations here don't match yours. Either way, I'd be ever so appreciative if someone could shed any light whatsoever on this topic. Thank you!
Subject: except.pl
#!/usr/bin/perl -w use strict; use Error qw(:try); use Spreadsheet::WriteExcel::Big; try { my $workbook = Spreadsheet::WriteExcel::Big->new("/tmp/foo.$$"); die "Error message successfully propagated!\n"; } catch Error with { my $E = shift; warn "An error occured: |$E|"; # ** The above prints: # An error occured: | at /path/to/Error.pm line 38. # | at except.pl line 14. # ** I expect it to print: # An error occured: |Error message successfully propagated! # | at except.pl line 14. };
RT-Send-CC: plan9 [...] eircom.net
On Thu Jan 04 11:52:25 2007, FOX wrote: Show quoted text
> Attached please find a tiny reproduction case for behavior that is > contrary to my expectation.
Additionally, I've experienced this behavior under Linux and on a Mac, using various versions of perl 5.8, on the latest versions of both Error (0.17008) and Spreadsheet::WriteExcel (2.17). Thanks again!
Well I don't have Spreadsheet::WriteExcel installed, so I tried without, and got the following: $ cat RT-24218.pl #!/usr/bin/perl -w use strict; use Error qw(:try); try { die "Error message successfully propagated!\n"; } catch Error with { my $E = shift; warn "An error occured: |$E|"; }; $ perl RT-24218.pl An error occured: |Error message successfully propagated! | at RT-24218.pl line 11. So I conclude that it breaks either as a consequence of the module being loaded, or as an exception thrown during its construction. If I then install the required dependencies, I can reproduce it. However, by changing the code very slightly to: try { Spreadsheet::WriteExcel::Big->new("/tmp/foo.$$"); die "Error message successfully propagated!\n"; } Ie simply calling the constructor in void context, the bug goes away. Most most peculiar. -- Paul Evans
From: FOX [...] cpan.org
On Thu Jan 04 15:30:45 2007, PEVANS wrote: Show quoted text
> However, by changing the code very slightly to: > > try { > Spreadsheet::WriteExcel::Big->new("/tmp/foo.$$"); > die "Error message successfully propagated!\n"; > } > > Ie simply calling the constructor in void context, the bug goes away. > Most most peculiar.
Nice find! Additionally, if you further change the code slightly to: try { my $workbook = Spreadsheet::WriteExcel::Big->new("/tmp/foo.$$"); undef $workbook; die "Error message successfully propagated!\n"; } Ie simply undefining the object that's returned as a result of the call to the constructor, the bug goes away. In other words, the mere presence of the return value of the call to Spreadsheet::WriteExcel::Big's constructor seems to cause the behavior to manifest.
From: FOX [...] cpan.org
Hello. Please close this ticket. This issue has been determined to not be related to Error.pm. Details at: http://groups.google.com/group/spreadsheet-writeexcel/browse_thread/thread/f5007499fc381870/f0ef61f5c49464cb Thank you. :-)