JK Web Studio

Specializing in efficient and user friendly web design solutions

info@jkwebstudio.com

Capturing both a Mason component’s output and return value

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’ &>

Leave a Reply