On Fri, 19 Oct 2007, Vince Veselosky wrote:

> my $compiler =  HTML::Mason::Compiler->new();
> $compiler->allow_globals => [qw($session $cookies $dbh $sth $sth2 $ref)];

That's some very interesting method calling syntax, but despite Perl's 
DWIMmery, it won't do what you want ;)

You have to pass the allow_globals parameter to the constructor:

   my $c = HTML::Mason::Compiler->new( allow_globals => [ ... ] );

I suspect this code wasn't run with warnings on, because if it were 
there'd get a nice warning "Useless use of single ref constructor in void 
context". That's a bit mysterious, but at least in points you to the right 
line.

> I am assuming here that your "session.pl" is actually a Mason component and
> not a perl script. I have no idea what happens if you ask Mason to exec() a
> perl script, but I doubt anything useful will come of it.

The most likely outcome is that Mason will "compile" it to a component 
that just outputs the text of your script. Mason's syntax is intentionally 
very unlikely to pop up in random Perl code.

> You might also consider passing your variables as arguments in exec()
> instead of using globals. It takes fewer lines of code, and it is less
> likely to create problems under mod_perl where globals can retain their
> values from one request to the next.

Agreed.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to