Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

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

X Report information
Id: 24218
Status: resolved
Left: 0 min
Priority: 0/0
Queue: Error

Owner: Nobody
Requestors: FOX <FOX [...] cpan.org>
Cc:
AdminCc:

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




X History Display mode: Brief headersFull headers
#   Thu Jan 04 11:52:25 2007 FOX - Ticket created  
Subject: Empty exception issue
[text/plain 834b]
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

[text/x-perl-script 530b]
#!/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.
};

#   Thu Jan 04 12:15:55 2007 FOX - Correspondence added  
RT-Send-CC: plan9[...]eircom.net
[text/plain 345b]
On Thu Jan 04 11:52:25 2007, FOX wrote:
> 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!
#   Thu Jan 04 12:16:05 2007 FOX - Status changed from 'new' to 'open'  
#   Thu Jan 04 15:30:45 2007 PEVANS - Correspondence added  
[text/plain 876b]
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
#   Thu Jan 04 16:12:02 2007 FOX - Correspondence added  
From: FOX[...]cpan.org
[text/plain 800b]
On Thu Jan 04 15:30:45 2007, PEVANS wrote:
> 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.
#   Sat Jan 06 00:50:08 2007 FOX - Correspondence added  
From: FOX[...]cpan.org
[text/plain 232b]
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. :-)
#   Sat Jan 06 00:52:30 2007 FOX - Status changed from 'open' to 'resolved'