I have a script that's written in perl, and executed as CGI. It works fine. Recently I have installed the mod_perl module into apache, and used the PerlModule ModPerl::Registry directive.
PerlModule ModPerl::Registry
PerlModule CGI
PerlSendHeader On
Alias /perl/ /real/path/to/perl/scripts/
<Location /perl>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
</Location>
<Files *.perl>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
</Files>
I've read that using this I do not need to modify my cgi perl code. (I always use strict pragma, so don't worry about uninitialized global variables and stuff like that).
My original script still works as intended, except for one thing, files that I included with the require() function can no longer be resolved.
script.cgi:
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard Vars);
require "includes/functions.cgi";
#blah blah, more stuff
script.perl
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard Vars);
require "includes/functions.perl"; # <---- Returns error: Can't locate includes/functions.perl in @INC
#blah blah, more stuff
The directory structure works like this:
$ ls
script.cgi script.perl includes/
$ ls includes/
functions.cgi functions.perl