I've got a script that's designed in perl, and performed as CGI. It really works fine. Lately I've 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 have read that by using this I don't need to modify my cgi perl code. (I usually use strict pragma, so don't be concerned about uninitialized global variables and things like that).

My original script still works as intended, except to begin with, files which i incorporated using the require() function can no more 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

Your directory structure works such as this:

$ ls

script.cgi script.perl includes/

$ ls includes/

functions.cgi functions.perl

From: http://perl.apache.org/paperwork/2./api/ModPerl/Registry.html

META: document that for the time being we do not chdir() in to the script's dir, since it affects the entire process under threads. ModPerl::RegistryPrefork should be utilised by individuals that run only under prefork MPM.

so, if you are using Apache2's prefork MPM, you should attempt using ModPerl::RegistryPrefork. If you are using worker, or event, or home windows, you are going to need to improve your program not to think that the cwd may be the directory that the perl is relaxing in.