From: Nicholas Clark Date: Sat, 24 Dec 2005 16:27:28 +0000 (+0000) Subject: The value from caller doesn't change, so my $pkg = caller; X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39a108ce50cdda5b6c5584d8056cebaacd441121;p=p5sagit%2Fp5-mst-13.2.git The value from caller doesn't change, so my $pkg = caller; should be moved out of the loop. p4raw-id: //depot/perl@26485 --- diff --git a/lib/constant.pm b/lib/constant.pm index 19edca0..0a866aa 100644 --- a/lib/constant.pm +++ b/lib/constant.pm @@ -30,6 +30,7 @@ sub import { return unless @_; # Ignore 'use constant;' my $constants; my $multiple = ref $_[0]; + my $pkg = caller; if ( $multiple ) { if (ref $_[0] ne 'HASH') { @@ -46,7 +47,6 @@ sub import { require Carp; Carp::croak("Can't use undef as constant name"); } - my $pkg = caller; # Normal constant name if ($name =~ /^_?[^\W_0-9]\w*\z/ and !$forbidden{$name}) {