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:

$conBuild = "rss_function";
or the equivalent you could say
$conBuild = $funcTable{rss_function};
where %funcTable is defined elsewhere in some manner like
%funcTable = ( .... rss_function => \&actual_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:
...other code... { no strict 'refs'; print &$conBuild($data,$file,$num,$ty,1); } ...other code...
This way strict will be turned off in only the one place you need it.

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
    Interesting, when you said that mod_perl doesn't force strict, I commented out that part of the script and it prints in SSH with no errors, and no errors in the log, still sending me to this darn 502 page.
      A 502 is a proxy problem. Are you using a proxy in front of the server? What happens if you access the server directly? Maybe it's not sending the output you think it is.
        Haha, I had my return value (1;) from the require above my DBI connection, so none of it was getting passed in mod_perl (worked fine in mod_cgi), and thus it was causing a cascade of problems that showed rss_function causing the error.

        whew, this brings to light that I need to start making more objects, less environment to deal with.

        By the way, I do have a reverse proxy installed for the static site content, I guess the problem propagates everywhere when you keep everything in memory. Anyways, thanks for your help!