in reply to Storing references to constructors with context
So the %constructors hash will consist of the class names and the method names of the constructors, simple as that :)my %constructors = ( One => 'new', Two => 'new', ); sub factorish { my ( $type, @arguments ) = @_; die "No handler for $type." unless exists $constructors{ $type } and my $method = $constructors{ $type }; return $type->$method( @arguments ); }
_________
broquaint
|
|---|