in reply to Package Variables in Inheritance
The SUPER:: trick works by SUPER::AUTOLOAD catching method calls and redirecting it up the inheritance hierarchy.Test->new(); # Calls Obj::new Test::new(); # Fails $Test::$foo; # Fails for the same reason that Test::new did
Therefore you will either have to arrange to be using method lookups (exactly like perrin suggested) or you will have to figure out the package that you want to look things up in and look stuff up dynamically on the fly using typeglobs etc.
Of the two options, I would think that methods are a cleaner way to go. But if you want...
sub test { my $self = shift; my $class = ref($self) || $self; local $Name; { no strict 'refs'; *Name = \${"$class\::Name"}; } print $Name; }
|
|---|