Acme-Tao

 view release on metacpan or  search on metacpan

Tao.pm  view on Meta::CPAN

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
);
 
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 )