You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2003/03/18 23:59:11 UTC
[mp2] adding SERVER_ROOT and SERVER_ROOT/lib/perl to @INC
Nick Tonkin wrote:
> On Mon, 17 Mar 2003, Perrin Harkins wrote:
>
>
>>Goehring, Chuck Mr., RCI - San Diego wrote:
>>
>>> Where do you put your .pm files for application-specific code?
>>
>>Under mod_perl 1, I just put them in <SERVER_ROOT>/lib/perl, which is
>>automatically added to @INC by mod_perl. Can someone confirm if this
>>still works for mp2?
>
>
> I do not believe so.
Though it is easy to add. See the patch below.
The question is, do we want to have this feature in mp2? Does it really save
someone a trouble of creating a startup file? Also, In 2.0 you don't have to
create a startup file for that, you can simply say:
PerlSwitches -I/home/httpd -I/home/httpd/lib/perl
Admittedly you will have to hardcode the document root in this case, but you
do that anyways in httpd.conf when you specify it.
Index: src/modules/perl/mod_perl.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.157
diff -u -r1.157 mod_perl.c
--- src/modules/perl/mod_perl.c 17 Mar 2003 02:15:09 -0000 1.157
+++ src/modules/perl/mod_perl.c 18 Mar 2003 22:55:08 -0000
@@ -190,6 +190,11 @@
);
#endif
+ av_push(GvAV(PL_incgv),
+ newSVpv(ap_server_root_relative(p, ""), 0));
+ av_push(GvAV(PL_incgv),
+ newSVpv(ap_server_root_relative(p, "lib/perl"), 0));
+
if (!modperl_config_apply_PerlRequire(s, scfg, perl, p)) {
exit(1);
}
__________________________________________________________________
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: [mp2] adding SERVER_ROOT and SERVER_ROOT/lib/perl to @INC
Posted by Stas Bekman <st...@stason.org>.
I've committed the code that adds SERVER_ROOT and SERVER_ROOT/lib/perl to
@INC, but it's disabled if an explicit MP_COMPAT_1X=0 is passed to Makefile.PL
(it's enabled by default).
I'll document shortly what other mp1-compat features can be disabled by
passing MP_COMPAT_1X=0...
__________________________________________________________________
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: [mp2] adding SERVER_ROOT and SERVER_ROOT/lib/perl to @INC
Posted by Nick Tonkin <ni...@tonkinresolutions.com>.
On Tue, 18 Mar 2003, Geoffrey Young wrote:
>
>
> Stas Bekman wrote:
> > Perrin Harkins wrote:
> >
> >> Stas Bekman wrote:
> >>
> >>> The question is, do we want to have this feature in mp2?
> >>
> >>
> >>
> >> I thought it was cool to have it automatically add a path relative to
> >> the server root, because it makes it feel more like you are writing
> >> real Apache modules, and not just CGI scripts. It's just a warm fuzzy
> >> thing really. I have no problem with dropping that feature and adding
> >> the path myself in startup.pl or httpd.conf.
> >
> >
> > I'm +0 on adding this feature. While I have never used it myself, I see
> > no harm in keeping back-compatibility with 1.0. Unless someone has a
> > reason for not having it I'll commit the patch I've posted earlier.
Is there a performance hit to having @INC include another directory (that
will not be used by many [most?] users)? If so, that's a good argument
against.
>
> in 1.0 I used it all the time and liked having it there. however, I
> suspect that doug left it out on purpose - IIRC PerlSwitches was his
> answer when this was asked before (maybe it was at a conference, I
> can't remember).
I think Doug was right. PerlSwitches is a more flexible, more perlsih and
mod_perlish way of doing it, IMO. Just needs good documentation :)
- nick
--
~~~~~~~~~~~~~~~~~~~~
Nick Tonkin {|8^)>
Re: [mp2] adding SERVER_ROOT and SERVER_ROOT/lib/perl to @INC
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Stas Bekman wrote:
> Perrin Harkins wrote:
>
>> Stas Bekman wrote:
>>
>>> The question is, do we want to have this feature in mp2?
>>
>>
>>
>> I thought it was cool to have it automatically add a path relative to
>> the server root, because it makes it feel more like you are writing
>> real Apache modules, and not just CGI scripts. It's just a warm fuzzy
>> thing really. I have no problem with dropping that feature and adding
>> the path myself in startup.pl or httpd.conf.
>
>
> I'm +0 on adding this feature. While I have never used it myself, I see
> no harm in keeping back-compatibility with 1.0. Unless someone has a
> reason for not having it I'll commit the patch I've posted earlier.
in 1.0 I used it all the time and liked having it there. however, I
suspect that doug left it out on purpose - IIRC PerlSwitches was his
answer when this was asked before (maybe it was at a conference, I
can't remember).
anyway, I'd say do it and let purists complain later - it will make
porting that much more seamless.
--Geoff
Re: [mp2] adding SERVER_ROOT and SERVER_ROOT/lib/perl to @INC
Posted by Stas Bekman <st...@stason.org>.
Perrin Harkins wrote:
> Stas Bekman wrote:
>
>> The question is, do we want to have this feature in mp2?
>
>
> I thought it was cool to have it automatically add a path relative to
> the server root, because it makes it feel more like you are writing real
> Apache modules, and not just CGI scripts. It's just a warm fuzzy thing
> really. I have no problem with dropping that feature and adding the
> path myself in startup.pl or httpd.conf.
I'm +0 on adding this feature. While I have never used it myself, I see no
harm in keeping back-compatibility with 1.0. Unless someone has a reason for
not having it I'll commit the patch I've posted earlier.
__________________________________________________________________
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: [mp2] adding SERVER_ROOT and SERVER_ROOT/lib/perl to @INC
Posted by Perrin Harkins <pe...@elem.com>.
Stas Bekman wrote:
> The question is, do we want to have this feature in mp2?
I thought it was cool to have it automatically add a path relative to
the server root, because it makes it feel more like you are writing real
Apache modules, and not just CGI scripts. It's just a warm fuzzy thing
really. I have no problem with dropping that feature and adding the
path myself in startup.pl or httpd.conf.
- Perrin