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