You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by colin_e <co...@bigfoot.com> on 2005/01/25 16:44:12 UTC

[users@httpd] Basic stuff- start.pl not affecting @INC

Hi Guys. After a long holiday i'm trying to get back into my Perl work, 
and sort out a problem I
saw before Christmas.

Given-

httpd.conf
=======
ServerRoot "C:/Prog/Apache/Apache2"
PerlRequire "conf/start.pl"

C:/Prog/Apache/Apache2/conf/start.pl
==========================
use Apache2 ();
use lib qw(I:/WWW/private/lib);
1;                            # return true

Test Script
=======
#use Apache2 ();
#use lib qw(I:/WWW/private/lib);
use DDAdmin::Main;
$app= DDAdmin::Main->new();
$app->process;


The code as shown fails because it cannot find the library 
"DDAdmin::Main" that sits in
I:/WWW/private/lib/DDAdmin/Main.pm, even though this directory should 
have been
added to the include path with "use lib" in start.pl. The error is:

    Can't locate DDAdmin/Main.pm in @INC (@INC contains: 
C:/Prog/Perl/lib C:/Prog/Perl/site/lib .)
    at I:\\WWW\\private\\res\\testapp\\DDAdmin.pl line 8.

If I uncomment the "use" lines in the test script itself it runs OK, so 
the paths are correct.

If I rename my start.pl to something else I get an apache startup "file 
not found" error ,
and if I change the last line to "0;" instead of "1;" I get a "Can't 
load perl file" error, both
indicating that my start.pl file IS being read and executed  when 
correctly named.

However I can see that neither of the "use" directives in the start.pl 
file are successfully
adding directories to the @INC array, as seen by the script. This is 
pretty basic stuff,
any idea what i am doing wrong?

Regards: Colin



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Basic stuff- start.pl not affecting @INC

Posted by Joshua Slive <js...@gmail.com>.
On Tue, 25 Jan 2005 15:44:12 +0000, colin_e <co...@bigfoot.com> wrote:
> httpd.conf
> =======
> ServerRoot "C:/Prog/Apache/Apache2"
> PerlRequire "conf/start.pl"

You probably want to ask on the mod_perl list.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Basic stuff- start.pl not affecting @INC- IGNORE (Fixed)

Posted by colin_e <co...@bigfoot.com>.
Belay that.

More experimentation with the perl-status module showed that @INC WAS 
being set up,
but my script wasn't seeing it. I finally realised that at some point I 
had configured the script
handler with-

            SetHandler cgi-script

when it should have been-

            SetHandler perl-script

And (reasonably I suppose) it's only perl-script that sets up @INC in 
the environment.

Doh (slaps head).

So sorry for the wasted bandwidth, but at least I answered my own 
question...

Regards: Colin

colin_e wrote:

> Hi Guys. After a long holiday i'm trying to get back into my Perl 
> work, and sort out a problem I
> saw before Christmas.
>
> Given-
>
> httpd.conf
> =======
> ServerRoot "C:/Prog/Apache/Apache2"
> PerlRequire "conf/start.pl"
>
> C:/Prog/Apache/Apache2/conf/start.pl
> ==========================
> use Apache2 ();
> use lib qw(I:/WWW/private/lib);
> 1;                            # return true
>
> Test Script
> =======
> #use Apache2 ();
> #use lib qw(I:/WWW/private/lib);
> use DDAdmin::Main;
> $app= DDAdmin::Main->new();
> $app->process;
>
>
> The code as shown fails because it cannot find the library 
> "DDAdmin::Main" that sits in
> I:/WWW/private/lib/DDAdmin/Main.pm, even though this directory should 
> have been
> added to the include path with "use lib" in start.pl. The error is:
>
>    Can't locate DDAdmin/Main.pm in @INC (@INC contains: 
> C:/Prog/Perl/lib C:/Prog/Perl/site/lib .)
>    at I:\\WWW\\private\\res\\testapp\\DDAdmin.pl line 8.
>
> If I uncomment the "use" lines in the test script itself it runs OK, 
> so the paths are correct.
>
> If I rename my start.pl to something else I get an apache startup 
> "file not found" error ,
> and if I change the last line to "0;" instead of "1;" I get a "Can't 
> load perl file" error, both
> indicating that my start.pl file IS being read and executed  when 
> correctly named.
>
> However I can see that neither of the "use" directives in the start.pl 
> file are successfully
> adding directories to the @INC array, as seen by the script. This is 
> pretty basic stuff,
> any idea what i am doing wrong?
>
> Regards: Colin
>
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org