Does mod_perl handle inclusion paths differently than cgi?

I have a script that is written in perl and executed as CGI. It is working fine. I recently installed the mod_perl module in 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 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 the like).

My original script still works as intended, except for one thing, the files that I included in 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 as follows:

$ ls

script.cgi script.perl includes /

$ ls includes /

functions.cgi functions.perl

+3
1

: http://perl.apache.org/docs/2.0/api/ModPerl/Registry.html

META: , chdir() script, . ModPerl:: RegistryPrefork , MPM.

, Apf2 prefork MPM, ModPerl:: RegistryPrefork. , , , cwd - , perl.

+2

Source: https://habr.com/ru/post/1752158/


All Articles