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

mason: how to get attr out of a subcomponent?

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

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

Hi!

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('current.mc')->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 masonhq.com 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:
    $m->callers(1)->attr('bar');
    will do the trick....

    -Blake

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

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found