Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

mason: how to get attr out of a subcomponent?

by alfie (Pilgrim)
on Aug 27, 2001 at 20:03 UTC ( #108160=perlquestion: print w/replies, xml ) Need Help??

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


I faced a quite strange problem today: We are running a mason-powered site which is really a great thing. For I just started with mason just some weeks ago I first used <%method> to hand over some arguments from the component to the autohandler.

Now I found out about the usage of <%attr> and wanted to use that instead. To have a fallback through the transition I wanted to get the attr inside the method to hand it over. The problem is, a method is a subcomponent.

Now, how can I hand over the attr from the current component within a method without having to do such strange things like this:

<%method foo> % return $m->fetch_comp('')->attr('bar'); </%method>
As you might see this is quite annoying for I have to put the name of the current component into it. But if I use current_comp instead of fetch_comp I get the subcomponent (which is foo in this case), and if I use parent I get the autohandler, not the real component.

So - to put it simple: How can I get to the real component from a sub component? I have tried to dig through the docs at but haven't found anything useful - I guess I'm just blind and it might get worse after searching for several hours. So - any hint would be greatful!
use signature; signature(" So long\nAlfie");

Replies are listed 'Best First'.
Re: mason: how to get attr out of a subcomponent?
by blakem (Monsignor) on Aug 27, 2001 at 21:06 UTC
    This is from memory, but I think:
    will do the trick....


      Unfortunately, callers(1) gives me the same result like current_comp->parent. With value of 0 I get the current_comp, so this doesn't help at all.

      No one else an idea? Am I out of luck? Unfortunately the #mason on opn seems to be quite dead (it's empty after all) so I think I'll have to bug the mailing lists. Thanks anway for the try.
      use signature; signature(" So long\nAlfie");

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2022-01-18 11:50 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (53 votes). Check out past polls.