develooper Front page | perl.perl5.porters | Postings from August 2008

Re: the warning about parents in Universal->isa

Thread Previous | Thread Next
August 23, 2008 09:27
Re: the warning about parents in Universal->isa
Message ID:
On Saturday 23 August 2008 06:20:56 Chris Prather wrote:

> On Fri, Aug 22, 2008 at 4:53 PM, chromatic <> wrote:

> > On Friday 22 August 2008 08:11:44 Yuval Kogman wrote:

> > > Also now that we have DOES it seems fair to just shove names onto
> > > @ISA for interfaces with no functionality whatsoever.

> > Ugh, no.  Override DOES instead.  They're different for a reason.

> How do you override a method without subclassing, using a method modifier
> (Moose, Class::MethodModifiers),  or doing something naughty like:

> my $next = MyApp->can('DOES');
> *MyApp::DOES = sub { my $self = shift; my @ret = $self->$next(@_); push
> @ret, __PACKAGE__ };

You use a prototype-based OO system and modify the method on a specific 
instance, or a multimethod system and add another multi variant.  Otherwise, 
the way you modify a class in a class-based OO system is to modify the class.

-- c

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About