You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jason Jolly <ja...@hotmail.com> on 2003/03/24 18:29:11 UTC

Addition of directory to @INC variable via startup script/mod_perl

I currently have the following configuration in my httpd.conf file:

    PerlRequire /usr/local/apache/conf/startup.pl
    Alias /perl/ /usr/local/apache/cgi-bin
    PerlTaintCheck  On
    PerlWarn        On
    PerlFreshRestart On
    PerlTransHandler Apache::SessionManager
    PerlFreshRestart On

    <Location /perl>
    SetHandler      perl-script
    PerlSendHeader  On
    PerlHandler     Apache::Registry
    Options         ExecCGI
    </Location>

And here are the contents of the startup.pl script:

    #!/usr/bin/perl

    use strict;

    use lib qw(/usr/local/apache/require);
    
    use Apache::Registry();
    use CGI();
    use CGI::Session();
    use CGI::Carp();
    use DBI();
    use Net::LDAP();

    $ENV{MOD_PERL} or die "not running under mod_perl!";

    1;

When I stop/start the server and run a script with the following code:

    foreach $item (@INC) {
        print ($item . "<br>");
    }

I only get the output:

    /usr/local/lib/perl5/5.8.0/sun4-solaris
    /usr/local/lib/perl5/5.8.0
    /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.8.0
    /usr/local/lib/perl5/site_perl
    .

??  I can't seem to find any rhyme or reason why the directory "/usr/local/apache/require" isn't on the @INC array?

Any help is greatly appreciated.....according to all documentation I can find this should actually work.  I'm hoping that I'm doing something terribly stupid :).

thnx,

~j



Re: Addition of directory to @INC variable via startup script/mod_perl

Posted by Perrin Harkins <pe...@elem.com>.
Jason Jolly wrote:
> When I stop/start the server and run a script with the following code:
>  
>     foreach $item (@INC) {
>         print ($item . "<br>");
>     }
>  
> I only get the output:
>  
>     /usr/local/lib/perl5/5.8.0/sun4-solaris
>     /usr/local/lib/perl5/5.8.0
>     /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris
>     /usr/local/lib/perl5/site_perl/5.8.0
>     /usr/local/lib/perl5/site_perl
>     .
>  
> ??  I can't seem to find any rhyme or reason why the directory 
> "/usr/local/apache/require" isn't on the @INC array?

When do you run that script?  And why do you have PerlFreshRestart on?

- Perrin