Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

custom module access problem

Status
Not open for further replies.

nexus1001

IS-IT--Management
Sep 27, 2001
13
0
0
DE
I am trying to access a custom developed perl module from a little cgi script in perl, but when I want to access a function from my module, apache tells me I tried to access an undefined subroutine.
Before all of you flame me, I exported my routines, I even tried to use the same module with a script that is not running on apache and it worked!! I don't understand why a normal script can access those routines and my cgi script can't - I have run thorough sxntax checks and I just can't see why it isn't working !! please help I'm really stuck here...
 
' Sounds like your problem might be related to the fact that Apache
does not have the same path as you do. When you run the CGI from
a prompt, Perl knows to look in the current dir for the module.
When Apache tries to run the CGI, it will only use the default
Perl dirs. If that is the case, you need to put the module where
it can be found by Apache. Somewhere like where the CGI.pm is sitting.
Or add a little code to the CGI to let it see the module.

#!/usr/local/bin/perl
use lib "where/the/module/sits"; # tell Perl to use that dir as a lib dir
use YourModule;
use CGI;
........


Be aware that the "use lib" trick makes all the stuff in that dir available
to Perl and thus available to your CGI. That can represent a security
problem if you leave anything dangerous in that dir. Not much of a
problem, but, being sloppy there probably would not be a good idea.

HTH




HTH Please use descriptive titles and check the FAQs.
And, beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top