diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-12-24 16:27:28 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-12-24 16:27:28 +0000 |
commit | 39a108ce50cdda5b6c5584d8056cebaacd441121 (patch) | |
tree | 94ddb2dd233ec9233d505359c829e9ec4363c4f4 | |
parent | 69e7dc3c564b0153c599a70d21ee3044fc270d54 (diff) | |
download | perl-39a108ce50cdda5b6c5584d8056cebaacd441121.tar.gz |
The value from caller doesn't change, so my $pkg = caller;
should be moved out of the loop.
p4raw-id: //depot/perl@26485
-rw-r--r-- | lib/constant.pm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/constant.pm b/lib/constant.pm index 19edca0380..0a866aa0ac 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}) { |