rkg has asked for the wisdom of the Perl Monks concerning the following question:
Hi.
Mason scoping question. Here's a reduction that illustrates the issue:
Why does this work properly (that is, the error message is sent off to the component)
But this does not work properly (a blank string is sent off the component)<html> <body> % eval { die "this is an error"; }; % if ($@) { % my $message = $@; % $m->comp('/comps/error.comp', message=> $message); % } </body> </html>
Thanks for any insight.<html> <body> % eval { die "this is an error"; }; % if ($@) { % $m->comp('/comps/error.comp', message=> $@); % } </body> </html>
UPDATE
Ok, since (notice the quotes)
does work properly, I'm wondering if the issue is Mason, or if $@ has magic properties...$m->comp('/comps/error.comp', message=> "$@");
is $@ a simple scalar, or something more?
Back to
Seekers of Perl Wisdom