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

Re: the warning about parents in Universal->isa

Thread Previous | Thread Next
From:
chromatic
Date:
August 23, 2008 09:27
Subject:
Re: the warning about parents in Universal->isa
Message ID:
200808230926.53998.chromatic@wgz.org
On Saturday 23 August 2008 06:20:56 Chris Prather wrote:

> On Fri, Aug 22, 2008 at 4:53 PM, chromatic <chromatic@wgz.org> 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About