Class-Simple-Readonly-Cached
view release on metacpan or search on metacpan
lib/Class/Simple/Readonly/Cached.pm view on Meta::CPAN
# Premise: 'new' belongs to the wrapper, not to the inner object.
# Conclusion: short-circuit before any object check is needed.
return \&new if $method eq 'new';
# Premise: if $self is not a ref (class-level call) OR the inner object
# has been freed (global destruction), there is no object to delegate to.
# Conclusion: fall back to UNIVERSAL for what this package directly provides.
return $self->SUPER::can($method)
if !ref($self) || !ref($self->{object});
# Premise: $self->{object} is alive and is a valid reference (Invariant I4).
# Conclusion: delegate to the inner object first; fall back to UNIVERSAL.
return $self->{object}->can($method) // $self->SUPER::can($method);
}
=head2 isa
Test class membership, delegating to the inner object's class
hierarchy when needed. Overrides C<UNIVERSAL::isa> to support the
transparent decorator pattern.
( run in 0.713 second using v1.01-cache-2.11-cpan-14f38c9f855 )