【发布时间】:2011-11-06 13:26:57
【问题描述】:
是否可以为handler.pl中的全局变量赋值?
我需要为handler.pl 中的全局变量赋值,并从Mason 组件中获取值。
我试过这样:
httpd.conf
...
PerlRequire handler.pl
...
handler.pl
...
our $x = 'test';
...
something.mas
...
<h1><% $x %></h1>
...
但它不起作用,它不返回<h1>test</h1>,而只是返回<h1></h1>,因为$x 未定义。我怎样才能让它发挥作用?
【问题讨论】: