CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: mod_perl:
require / do


New User

Mar 17, 2005, 6:34 PM

Post #1 of 2 (15625 views)
require / do Can't Post


I've been programming under regular Perl for quite awhile and just recently installed mod_perl. I'm having an insane problem with require()-ing some configuration and subroutine files.

I have statements at the beginning of my programs like this:
require "./require/";

It works perfectly under CGI-Perl, but under mod_perl, it cannot ever find the file. (Cannot find ./require/ Magically, if I put the 'required' files in the same directory as the scripts that require them, it works, even if I put a full path or relative path in front of the filename.

In addition: if I change the "require" to "do", it seems to be able to find the file, but then it gives me an error about undefined subroutines when I try to use them. Again, if I put the file in the same directory, all works ok!

Can any body explain this?


Mar 19, 2005, 3:20 AM

Post #2 of 2 (15612 views)
Re: [dmspilot] require / do [In reply to] Can't Post

Under mod_perl you need to use full paths because of how the script is compiled and executed using a perl interpretter embedded in Apache.

The script is run as if it exists in the Apache root and so it can't find your module unless you specify the full path.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives