Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Tuesday February 12, 2008
10:18 AM

More Bugs Due to Global Changes

[ #35640 ]

Damn. I accepted a patch for aliased to have proper $SIG{__DIE__} handling, but it turned out to have a bug. I have to accept responsibility for this one since it is my module.

use Test::More tests => 1;
use aliased 'CGI';  # doesn't matter which module you use
ok 1, 'dummy test';
ok 1 - dummy test
Can't locate object method "bar" via package "Foo" (perhaps you forgot to load "Foo"?) at nofail.t line 504.
All tests successful.
Files=1, Tests=1,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.21 cusr  0.01 csys =  0.23 CPU)
Result: PASS

This fails because Test::Builder has its own $SIG{__DIE__} handler and it checks to see if it's in an eval. If not, it sets Test_Died to true. When we get to Foo->bar, Test::Builder's $SIG{__DIE__} handler is wiped out and it can't tell itself that the test died. I hope to have a new version up shortly.

In other words, we once again have a problem with writing code with a global effect. I don't know how this one could be avoided in Test::Builder, but aliased clearly had this wrong.

In this case, the intent of the $SIG{__DIE__} handling code in aliased was not to alter anything about the handlers, but to preserve their semantics just as if you hadn't used aliased. This now brings me up to four modules which have caused various bugs or performance hits here because of global effects. This is not the largest code base I've worked on, but I'm surprised that we're having a much larger problem than I've seen in others.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.