Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^3: Moose - two augmented methods in one class

by tobyink (Abbot)
on Jan 09, 2012 at 15:37 UTC ( #947022=note: print w/replies, xml ) Need Help??

in reply to Re^2: Moose - two augmented methods in one class
in thread Moose - two augmented methods in one class

Actually, in the example, it does seem necessary, as it seems to hit onto a barely documented area of Moose behaviour bug according to several people in #moose in The html method defined in the superclass, calls head defined in the invocant. head isn't augmented in the subclass, so the head method defined in the superclass is used directly. This calls inner which searches up the callstack for an augmented method. While we'd want it to find head, that method is not augmented in the subclass, so it finds html instead, inadvertently using the wrong augmentation.

Try the code from the original question and you'll see.

Replies are listed 'Best First'.
Re^4: Moose - two augmented methods in one class
by tobyink (Abbot) on Jan 09, 2012 at 16:13 UTC

      I think the lesson to be learned here is simply "don't use augment/inner for anything complicated", which can be whittled down to "don't use augment/inner" if you like.

      Basically, it was an interesting feature, but not something I would advise leaning on too heavily. Not only is the implementation problematic, but the semantics are just plain weird (even in the BETA language from which I originally stole it).


        Would it be fair to say then, that issue #73850 should be subsumed into a larger issue: "inner/augment need moving into a MooseX release"?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://947022]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2016-10-27 17:25 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (366 votes). Check out past polls.