in reply to Mod_perl strict problem
It is true that strict doesn't like dynamically setting function names, also known as symbolic references. The usual answer is to create some kind of table to track references to your subroutines. In other words, rather than saying:
or the equivalent you could say$conBuild = "rss_function";
where %funcTable is defined elsewhere in some manner like$conBuild = $funcTable{rss_function};
See perlref for more on coderefs, as these are called. If for some reason this won't work and you really need to use a string as the subroutine name, then you will need to turn off strict for that part of your code. The cleanest way to do this is to use a block around just the part where the symbolic reference is used:%funcTable = ( .... rss_function => \&actual_rss_function, ... );
This way strict will be turned off in only the one place you need it....other code... { no strict 'refs'; print &$conBuild($data,$file,$num,$ty,1); } ...other code...
By the way, while using strict is a good idea in general, I can't think of any reason why mod_perl would force you to use strict. Can you shed some more light on that?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Mod_perl strict problem
by hollandjustin (Initiate) on Apr 07, 2007 at 19:04 UTC | |
by perrin (Chancellor) on Apr 07, 2007 at 19:31 UTC | |
by hollandjustin (Initiate) on Apr 07, 2007 at 21:52 UTC |