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" }
In reply to Re: How to implement such kind of magic?
by BrowserUk
in thread How to implement such kind of magic?
by llancet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |