FindApp
view release on metacpan or search on metacpan
lib/FindApp/Object/Class.pm view on Meta::CPAN
# This is so subclasses can stick their own singleton into our
# slot without knowing who else put what there.
sub renew { &ENTER_TRACE;
my $self = shift;
my $new = $self->new;
my $old = $self->old;
$new->copy($old);
$self->old($new);
}
## UNITCHECK { __PACKAGE__->renew } # stash new singleton
# Return singleton, making one as needed.
# Stash the argument as the new singleton.
sub old { &ENTER_TRACE;
my($self, $new) = @_;
state $Singleton;
$Singleton = $new if $new;
return $Singleton ||= $self->new;
}
( run in 2.290 seconds using v1.01-cache-2.11-cpan-748bfb374f4 )