## In Widget sub make_color_widget { my $class = shift; my $new_color = shift; my( @widget_args ) = @_; { no strict refs; @{ qq{Widget::${new_color}::ISA } = (qw( Widget ) ); } my $self = {@widget_args}; return bless $self, qq{Widget::$new_color}; } sub my_color { my $self = shift; return ( (ref $self) =~ m{^Widget::(.*)} )[0]; }