my %constructors = ( "one" => \One->new,
"two" => \Two->new );
sub factorish {
my ( $type, @arguments ) = @_;
my $consref = $constructors{ $type }
or die "No handler for $type.";
return $consref -> ( @arguments );
}
####
my %constructors = ( "one" => \&One::new,
"two" => \&Two::new );
####
my %constructors = ( "One" => \&One::new,
"Two" => \&Two::new );
sub factorish {
my ( $type, @arguments ) = @_;
my $consref = $constructors{ $type }
or die "No handler for $type.";
return $consref -> ( $type, @arguments );
}