Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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 irc.perl.org. 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.


Comment on Re^3: Moose - two augmented methods in one class
Select or Download Code
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).

      -stvn

        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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2014-07-30 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (236 votes), past polls