develooper Front page | perl.moose | Postings from February 2009

Re: advice on wrapping methods from a superclass

Thread Previous | Thread Next
Dave Rolsky
February 11, 2009 12:42
Re: advice on wrapping methods from a superclass
Message ID:
On Wed, 11 Feb 2009, Oliver Charles wrote:

> On Wed, Feb 11, 2009 at 7:01 PM, Dave Rolsky <> wrote:
>> You want to use augment/inner, I think.
>> See
>> and
> Actually, I think Jonathan is looking for inner and augment but the
> other way round... Augment works on the subclass, but Jonathan needs
> to run it in the superclass. I ran into just this problem, and ended
> up going with the "sub foo" and "sub _do_foo" approach, but it's not
> the nicest solution.

This is _exactly what augment/inner is for!

  package Parent;

  sub foo {
      my $self = shift;


  package Child;

  extends 'Parent';

  augment 'foo' => sub {
      my $self = shift;



Your guide to all that's veg      House Absolute(ly Pointless)

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