Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Question on overriding a Mason method

by freddo411 (Chaplain)
on Jan 11, 2012 at 19:08 UTC ( [id://947411]=perlquestion: print w/replies, xml ) Need Help??

freddo411 has asked for the wisdom of the Perl Monks concerning the following question:

I'm attempting to override a Mason method on one of my pages. I'd like to inherit the behavior of the parent method, but add a few bits to the output.
My hierarchy looks like this:
auto -> auto2 -> my_page
The parent method "leftnav" is defined in auto.
I expected my code in my page to look something like this:
<%method leftnav> <%perl> $m->comp( PARENT:leftnav, %ARGS ); # some code here to add some stuff at the bottom </%perl> </%method>
The above does not work.
Question:
* Is there a syntax for "PARENT"? What is it?
* If no, how to code something like this?

-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday

Replies are listed 'Best First'.
Re: Question on overriding a Mason method
by Anonymous Monk on Jan 12, 2012 at 02:19 UTC

    The above does not work.

    How?

    http://www.masonhq.com/docs/manual/Devel.html#accessing_methods_and_attributes

      I found my incorrect syntax on this. I needed to quote the string argument to comp();
      The correct syntax is:
      <%perl> $m->comp( 'PARENT:leftnav', %ARGS ); # some code here to add some stuff at the bottom </%perl>

      -------------------------------------
      Nothing is too wonderful to be true
      -- Michael Faraday

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://947411]
Approved by Eliya
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found