%expand%
my $var = CGI::param('var');
sub x {
print $var;
}
Labels: programming
}))| Bracing against the wind | |
| www.documentroot.com |
|
Thursday, February 12, 2009
mod_perl and file-scoped lexicals don't work
File-scoped lexicals, when used in subroutines, are bound to the first-occurrence of the variable. Because of the way mod_perl works, this means that the first time you run a CGI program *within a given Apache process* it will work as expected. The second time and thereafter, those file-scoped lexicals will be bound to previous instances, and will contain previous values. OUCH! So code like this won't work: Note to self: NEVER use file-scoped lexicals in mod_perl unless you want to risk suicide and sleepless nights. Labels: programming [View/Post Comments] [Digg] [Del.icio.us] [Stumble] |
|
Bloghop:
|
Blogarama
|
Technorati
|
Blogwise