Object-Prototype
view release on metacpan or search on metacpan
lib/Object/Prototype.pm view on Meta::CPAN
my %constructor_of;
my %prototype_of;
sub new($$;$) {
my $class = shift;
my $constructor = shift;
my $self = Storable::dclone($constructor);
my $id = refaddr $self;
$constructor_of{$id} = $constructor;
$prototype_of{$id} = {};
bless $self => $class;
for my $method ( keys %{ $_[0] } ) {
$self->prototype( $method, $_[0]->{$method} );
}
return $self;
}
sub prototype($$;$) {
my $self = shift;
my $id = refaddr $self;
my $method = shift;
( run in 0.473 second using v1.01-cache-2.11-cpan-a5abf4f5562 )