in reply to Porting to mod_perl issues

Just added the following to my scripts before the require():

use strict; use lib qw(.);

And to global.pl:

package Northlands::Global;

And restarted Apache but I still get Internal Server Errors. Am I doing things right here?

Replies are listed 'Best First'.
Re^2: Porting to mod_perl issues
by Anonymous Monk on Jun 14, 2004 at 17:33 UTC

    I just removed use strict; and left package Northlands::Global; on global.pl. By using &Northlands::Global::somesub(); I can now call my subroutines from another script. However, this isn't working with $dbh for the DB connection, as it returns "Can't call method "prepare" on an undefined value".

    - Ralph.

Re^2: Porting to mod_perl issues
by Anonymous Monk on Jun 14, 2004 at 17:57 UTC

    Ok, getting better now. By calling $Northlands::Global::dbh->prepare() it's working now. However, when I do something such as &Northlands::Global::somesub("param","param");, global.pl isn't receiving the parameters when I read them with @_;. Any ideas?

    Thanks a lot :-)
    Ralph

      That should work fine. Are you sure that reading @_ is the problem? By the way, we don't use the "&" before subroutine calls anymore, except in special circumstances. See the perlsub man page.

        Hi, yup, I was actually passing along the parameter incorrectly. Forgot to include the $Northlands::Global::varname, it's working perfect now :-)

        Thanks a lot for all of your help!

        Ralph