Acme-Tao
view release on metacpan or search on metacpan
414243444546474849505152535455565758596061);
sub
import
{
my
$class
=
shift
;
if
(
@_
) {
my
(
$pkg
,
$file
,
$line
) =
caller
;
foreach
my
$v
(
@_
) {
# this is based on the perl 5.6.1 perldoc (perldoc constant)
# not sure why we have to pass $v through a regex -- otherwise,
# it gives us an error that we are trying to modify a constant
# value (which might be due to the pos($v) being modified)
$v
=~ m{(.*)};
my
$u
= $1;
$u
=~ s/^::/main::/;
my
$full_name
=
$v
=~ m{::} ?
$u
:
"${pkg}::$u"
;
die
"Uh, Oh! $full_name was declared constant before line $line of $file.\n"
if
$constant::declared
{
$full_name
};
}
}
( run in 0.238 second using v1.01-cache-2.11-cpan-55f5a4728d2 )