Subject: | Problem with eval, use and inheritance |
Hi,
When you have a class A using Attribute::Protected and class B
that extends class A, you get an error if you try you use B inside
an eval block.
Here is an example:
A.pm
-----
package Test::A;
use Attribute::Protected;
sub test : Protected {
}
1;
B.pm
-----
package Test::B;
use Attribute::Protected;
use base qw(Test::A);
1;
ab.pl
-----
#!/usr/local/bin/perl56
use Attribute::Protected;
eval "use Test::B";
die $@ if $@;
this script produces the following error :
Can't use string ("ANON") as a symbol ref while "strict refs" in use at /usr/local/lib/perl5/site_perl/5.6.1/Attribute/Protected.pm line 13.
BEGIN failed--compilation aborted at Test/A.pm line 6.
Compilation failed in require at (eval 2) line 3.
...propagated at /usr/local/lib/perl5/5.6.1/base.pm line 62.
BEGIN failed--compilation aborted at Test/B.pm line 5.
Compilation failed in require at (eval 1) line 2.
BEGIN failed--compilation aborted at (eval 1) line 2.
I'm using perl 5.6.1 on a Solaris 2.5 box.