Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2018-06-19 15:07 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.