JK Web Studio

Specializing in efficient and user friendly web design solutions

info@jkwebstudio.com

Archive for the ‘mason’ Category

Capturing both a Mason component’s output and return value

Wednesday, December 2nd, 2009

From the mason manual:

As of 1.10, component calls can accept an initial hash reference of modifiers. The only currently supported modifier is store, which stores the component’s output in a scalar reference. For example:

my $buf;
my $return = $m->comp( { store => \$buf }, ‘/some/comp’, type => ‘big’ );

This mostly duplicates the behavior of scomp, but can be useful in rare cases where you need to capture both a component’s output and return value.

This modifier can be used with the <& &> tag as well, for example:

<& { store => \$buf }, ‘/some/comp’, size => ‘medium’ &>

Using Mason Methods

Wednesday, September 30th, 2009

<& SELF:my_method,
arg1 => $arg1,
arg2 => $arg2,
&>