On Mon, Feb 04, 2002 at 08:28:41PM -0500, Michael G Schwern wrote:
> # Fake it so if someone asks for $post->can('some_message_meth')
> # we say yes.
> sub can {
> my($self, $meth) = @_;
> $self->SUPER::can($meth) || $self->{message}->can($meth);
> }
Note that this *assumes* that UNIVERSAL::can does "the right thing"
(as it does!), so people will *use* $object->can() to query the
capability; since your capabilities are determined at runtime, you
modify ->can() to reflect this dynamic nature of your objects.
What I propose is similar to this chicken/egg situation:
a) modify ->can to support list-of-of-methods in the simplest,
know-everything-at-compile-time-via-symbol-table, situation;
b) *then* modules may overwrite this type of ->can() to get the list
in more complicated situations;
One more remarks: make the API easy for AutoLoader/SelfLoader to
auto-generate; hmm, they both probably already put the stubs like
sub foo ($); # AUTOLOADed
maybe UNIVERSAL::can('*') should scan for these, and not for "real"
subroutines...
Ilya