in reply to How to implement such kind of magic?

Something like this?

package Base; our %types = qw/BASE_TYPE Some::Class/; sub get_type { return %types; } package Foo; our @ISA = qw/Base/; our %types = qw/FOO_TYPE Another::Class/; sub get_type { return ( Foo->SUPER::get_type(), %types ); } package Bar; our @ISA = qw/Base/; our %types = qw/BAR_TYPE Yet::Another::Class/; sub get_type { return ( Bar->SUPER::get_type(), %types ); } package main; use Data::Dump qw[ pp ]; my %foo_type = Foo->get_type(); pp \%foo_type; my %bar_type = Bar->get_type(); pp \%bar_type; __END__ c:\test>junk3 { BASE_TYPE => "Some::Class", FOO_TYPE => "Another::Class" } { BAR_TYPE => "Yet::Another::Class", BASE_TYPE => "Some::Class" }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW It is as I've been saying!(Audio until 20090817)