You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Adam Gent <ap...@hat-technologies.ltd.uk> on 2003/05/26 02:11:31 UTC

ModPerl::Registry and require command

Hi All,

I am running Apache 2 and mod_perl 1.99_09

All of my perl scripts are going through ModPerl::Registry.

I am having problems using the require command within the perl script.

I am doing require "session.pl";

The problem is that I am getting error messages saying that it can not find
session.pl when it is in the same directory.

How can I set-up mod_perl to look in the current directory or all
directories in a certain tree.

In my startup.pl file if I specify

use lib qw(/data/apache/mod_perl);

and place session.pl in there it works fine. But I do not want to have to do
that for each file that I 'require' not do I want to have to specify every
single path.

So is there anyway I can specify for the it to look under /data/apache to
find the files?

Any help would be appreciated.

Thanks,

Adam


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.483 / Virus Database: 279 - Release Date: 20/05/2003


Re: ModPerl::Registry and require command

Posted by Diego Thomas <di...@pfcnetwork.com.br>.
Confirmation of read asks.... sucks..
heh
cya
----- Original Message ----- 
From: "Adam Gent" <ap...@hat-technologies.ltd.uk>
To: "Stas Bekman" <st...@stason.org>
Cc: <mo...@perl.apache.org>
Sent: Monday, May 26, 2003 12:10 PM
Subject: Re: ModPerl::Registry and require command


> Hi,
>
> Thanks for the links.
>
> So for now the only way to do this would be to either code in the full
path
> to the file, or place each path in to the use lib qw(..)
>
> It is possible to place more than one path in the use lib qw(..)?
>
> Thanks,
>
> Adam
>
> ----- Original Message ----- 
> From: "Stas Bekman" <st...@stason.org>
> To: "Adam Gent" <ap...@hat-technologies.ltd.uk>
> Cc: <mo...@perl.apache.org>
> Sent: Monday, May 26, 2003 4:31 AM
> Subject: Re: ModPerl::Registry and require command
>
>
> > Adam Gent wrote:
> > > Hi All,
> > >
> > > I am running Apache 2 and mod_perl 1.99_09
> > >
> > > All of my perl scripts are going through ModPerl::Registry.
> > >
> > > I am having problems using the require command within the perl script.
> > >
> > > I am doing require "session.pl";
> > >
> > > The problem is that I am getting error messages saying that it can not
> find
> > > session.pl when it is in the same directory.
> > >
> > > How can I set-up mod_perl to look in the current directory or all
> > > directories in a certain tree.
> > >
> > > In my startup.pl file if I specify
> > >
> > > use lib qw(/data/apache/mod_perl);
> > >
> > > and place session.pl in there it works fine. But I do not want to have
> to do
> > > that for each file that I 'require' not do I want to have to specify
> every
> > > single path.
> > >
> > > So is there anyway I can specify for the it to look under /data/apache
> to
> > > find the files?
> > >
> > > Any help would be appreciated.
> >
> > Here is the explanation of the behavior you see:
> >
>
http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Registry___C_Apache__PerlRun__and_Friends
> >
>
http://perl.apache.org/docs/2.0/user/porting/compat.html#C__r_E_gt_chdir_file_
> >
> > And here is the explanation of the reason for that behavior:
> >
>
http://perl.apache.org/docs/2.0/user/coding/coding.html#Thread_environment_Issues
> >
> > Eventually it'll get resolved, but so far nobody has done anything about
> it,
> > besides Arhtur Bergman who started working on ex::threads::cwd
> > http://www.perl.com/pub/a/2002/06/11/threads.html?page=2
> > and somebody else should pick up and complete this module to make it
> really
> > useful.
> >
> > __________________________________________________________________
> > Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> > http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> > mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> > http://modperlbook.org http://apache.org   http://ticketmaster.com
> >
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.483 / Virus Database: 279 - Release Date: 19/05/2003
>


Re: ModPerl::Registry and require command

Posted by Stas Bekman <st...@stason.org>.
Adam Gent wrote:
> Hi,
> 
> Thanks for the links.
> 
> So for now the only way to do this would be to either code in the full path
> to the file, or place each path in to the use lib qw(..)

Or you can try to complete the library started by Arthur and then it'll work 
as with mp1.

> It is possible to place more than one path in the use lib qw(..)?

sure, you can also repeat it several times:

use lib qw(/foo /bar);
use lib '/mar';

the latest call appends the new dir to the front of @INC (i.e. it does: 
unshift @INC, @dirs;)

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: ModPerl::Registry and require command

Posted by Adam Gent <ap...@hat-technologies.ltd.uk>.
Hi,

Thanks for the links.

So for now the only way to do this would be to either code in the full path
to the file, or place each path in to the use lib qw(..)

It is possible to place more than one path in the use lib qw(..)?

Thanks,

Adam

----- Original Message ----- 
From: "Stas Bekman" <st...@stason.org>
To: "Adam Gent" <ap...@hat-technologies.ltd.uk>
Cc: <mo...@perl.apache.org>
Sent: Monday, May 26, 2003 4:31 AM
Subject: Re: ModPerl::Registry and require command


> Adam Gent wrote:
> > Hi All,
> >
> > I am running Apache 2 and mod_perl 1.99_09
> >
> > All of my perl scripts are going through ModPerl::Registry.
> >
> > I am having problems using the require command within the perl script.
> >
> > I am doing require "session.pl";
> >
> > The problem is that I am getting error messages saying that it can not
find
> > session.pl when it is in the same directory.
> >
> > How can I set-up mod_perl to look in the current directory or all
> > directories in a certain tree.
> >
> > In my startup.pl file if I specify
> >
> > use lib qw(/data/apache/mod_perl);
> >
> > and place session.pl in there it works fine. But I do not want to have
to do
> > that for each file that I 'require' not do I want to have to specify
every
> > single path.
> >
> > So is there anyway I can specify for the it to look under /data/apache
to
> > find the files?
> >
> > Any help would be appreciated.
>
> Here is the explanation of the behavior you see:
>
http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Registry___C_Apache__PerlRun__and_Friends
>
http://perl.apache.org/docs/2.0/user/porting/compat.html#C__r_E_gt_chdir_file_
>
> And here is the explanation of the reason for that behavior:
>
http://perl.apache.org/docs/2.0/user/coding/coding.html#Thread_environment_Issues
>
> Eventually it'll get resolved, but so far nobody has done anything about
it,
> besides Arhtur Bergman who started working on ex::threads::cwd
> http://www.perl.com/pub/a/2002/06/11/threads.html?page=2
> and somebody else should pick up and complete this module to make it
really
> useful.
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.483 / Virus Database: 279 - Release Date: 19/05/2003


Re: ModPerl::Registry and require command

Posted by Stas Bekman <st...@stason.org>.
Adam Gent wrote:
> Hi All,
> 
> I am running Apache 2 and mod_perl 1.99_09
> 
> All of my perl scripts are going through ModPerl::Registry.
> 
> I am having problems using the require command within the perl script.
> 
> I am doing require "session.pl";
> 
> The problem is that I am getting error messages saying that it can not find
> session.pl when it is in the same directory.
> 
> How can I set-up mod_perl to look in the current directory or all
> directories in a certain tree.
> 
> In my startup.pl file if I specify
> 
> use lib qw(/data/apache/mod_perl);
> 
> and place session.pl in there it works fine. But I do not want to have to do
> that for each file that I 'require' not do I want to have to specify every
> single path.
> 
> So is there anyway I can specify for the it to look under /data/apache to
> find the files?
> 
> Any help would be appreciated.

Here is the explanation of the behavior you see:
http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Registry___C_Apache__PerlRun__and_Friends
http://perl.apache.org/docs/2.0/user/porting/compat.html#C__r_E_gt_chdir_file_

And here is the explanation of the reason for that behavior:
http://perl.apache.org/docs/2.0/user/coding/coding.html#Thread_environment_Issues

Eventually it'll get resolved, but so far nobody has done anything about it, 
besides Arhtur Bergman who started working on ex::threads::cwd
http://www.perl.com/pub/a/2002/06/11/threads.html?page=2
and somebody else should pick up and complete this module to make it really 
useful.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com