summaryrefslogtreecommitdiff
path: root/lib/constant.pm
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-12-24 16:27:28 +0000
committerNicholas Clark <nick@ccl4.org>2005-12-24 16:27:28 +0000
commit39a108ce50cdda5b6c5584d8056cebaacd441121 (patch)
tree94ddb2dd233ec9233d505359c829e9ec4363c4f4 /lib/constant.pm
parent69e7dc3c564b0153c599a70d21ee3044fc270d54 (diff)
downloadperl-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
Diffstat (limited to 'lib/constant.pm')
-rw-r--r--lib/constant.pm2
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}) {