develooper Front page | perl.perl5.porters | Postings from May 2004

Re: constant.pm patch - resubmission

Thread Previous | Thread Next
From:
Michael G Schwern
Date:
May 8, 2004 16:15
Subject:
Re: constant.pm patch - resubmission
Message ID:
20040508201345.GB6292@localhost.telerama.com
On Fri, May 07, 2004 at 09:05:18PM +0200, Lukas Mai wrote:
>  # Some names are evil choices.
> -my %keywords = map +($_, 1), qw{ BEGIN INIT CHECK END DESTROY AUTOLOAD };
> +my %keywords = map +($_, 1), qw{ BEGIN INIT CHECK END DESTROY AUTOLOAD import };

This part I understand.


> +# Load Carp::croak on demand.

And I understand why you'd want to do that.


> +sub _croak {
> +    require Carp;
> +    no warnings 'redefine';
> +    *_croak = \&Carp::croak;
> +    goto &Carp::croak;
> +}

This is a little overdoing it.  You're optimizing the case where the
program has died but someone happens to have caught it in an eval.

Just do:

sub _croak {
    require Carp;
    goto &Carp::croak;
}


-- 
Michael G Schwern        schwern@pobox.com  http://www.pobox.com/~schwern/
Beer still cheaper than crack!

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About