perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: CGI::Carp
Date Sun, 11 May 2003 23:45:53 GMT
Daisuke Maki wrote:
> It seems to me that CORE::GLOBAL::* can only be overridden at compile 
> time? I just did a quick test:
> 
>   BEGIN{ *CORE::GLOBAL::die = sub { print "foo" } }
>   die "bar";
> 
> against
> 
>   *CORE::GLOBAL::die = sub { print "foo" };
>   die "bar";
> 
> and only the one with the begin block seems to work for me, in both 
> perl5.6.1 and perl5.8.0.

even with 5.005_03:

/tmp> perl-5.6.1 -le 'BEGIN{ *CORE::GLOBAL::die = sub { print "foo" }; } die 
"bar";'
foo
/tmp> perl-5.6.0 -le 'BEGIN{ *CORE::GLOBAL::die = sub { print "foo" }; } die 
"bar";'
foo
/tmp> perl-5.00503  -le 'BEGIN{ *CORE::GLOBAL::die = sub { print "foo" }; } 
die "bar";'
foo


> Lincoln Stein wrote:
> 
>> The fact is that this:
>>
>>     *CORE::GLOBAL::die = \&mydie;
>>
>> Does not work with 5.6.0 or 5.6.1 and I am getting bug reports 
>> regarding CGI::Carp.  Here is a test script:
>>
>> #!/usr/bin/perl  
>> use strict; *CORE::GLOBAL::die = \&mydie;  
>> print STDERR "VERSION = $]\n"; print STDERR "line 1\n"; die "dieing 
>> here\n"; print STDERR "line 2\n";  
>> sub mydie {   print STDERR "In die handler\n";   die $@; }  
>> When I run it, I get:
>>
>> VERSION = 5.006 line 1 dieing here
>> Rather than the expected "In die handler" message.
>>
>> Please tell me what I am doing wrong.
>>
>> Lincoln
>>
>> On Monday 05 May 2003 04:44 pm, Jarkko Hietaniemi wrote:
>>
>>>> CGI::Carp is no longer working consistently for all combinations of
>>>> Perl and mod_perl versions.  One way I have found to solve most of
>>>> the problems people are reporting is to backtrack and go back to
>>>> replacing the die handler this way:
>>>>
>>>>     $SIG{__DIE__} = \&mydie;
>>>>
>>>> rather than
>>>>
>>>>     *CORE::GLOBAL::die =&mydie;
>>>>
>>>> as is currently the case.
>>>>
>>>> The mailing lists are very confused (and confusing) on the issue of
>>>> the magic $SIG{__DIE__} data structure.  Can you offer any advice?
>>>
>>>
>>> What seems to be the, umm, confusion?  Reading perlfunc and perlvar
>>> on the subject I would say that $SIG{__DIE__} should *not* be used
>>> currently if one wants to write a 'handler' for die().  The problem
>>> is that the $SIG{__DIE__} is called also in evals.
>>
>>
>>
> 


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message