Return-Path: Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 32154 invoked by uid 500); 11 May 2003 23:45:54 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 32141 invoked from network); 11 May 2003 23:45:53 -0000 Message-ID: <3EBEE0B1.5040600@stason.org> Date: Mon, 12 May 2003 09:45:53 +1000 From: Stas Bekman Organization: Hope, Humanized User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daisuke Maki Cc: lstein@cshl.org, jhi@iki.fi, modperl@perl.apache.org Subject: Re: CGI::Carp References: <3E9633FA.5030008@stason.org> <200305051625.38051.lstein@cshl.org> <20030505204415.GQ381746@kosh.hut.fi> <200305111907.22529.lstein@cshl.org> <3EBEDDEA.3050403@wafu.ne.jp> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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