http://www.perlmonks.org?node_id=108160

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");