Acme-Cat-Schroedinger
view release on metacpan or search on metacpan
lib/Acme/Cat/Schroedinger.pm view on Meta::CPAN
my %overload = (
'0+' => sub {return ($_[0]= defined $coopRef?die:0);},
'""' => sub {return ($_[0]= defined $coopRef?die:'');}, # todo: include temperament
'@{}' => sub {return ($_[0]=$coopRef // []);}, # todo: include temperament
'%{}' => sub {return ($_[0]=$coopRef // {});}, # todo: include temperament
'${}' => sub {return ($_[0]=$coopRef // \0);}, # todo: include temperament
'*{}' => sub {return ($_[0]=$coopRef // \*{''});}, # todo: include temperament
);
return $overload{$attr};
};
bless $self, $class;
}
=head1 SYNOPSIS
A newly-created Acme::Cat::Schroedinger could be anything. It could be cooperative, and be anything you want it to be. It could be perverse and will never be what you want it to be. Or it could behave like the original Schroedinger's Cat and its beha...
my $cat = Acme::Cat::Schroedinger->new();
print %{$cat}; # The cat is now an empty hashref, and does not die.
# or...
( run in 0.855 second using v1.01-cache-2.11-cpan-de7293f3b23 )