Re: Re: Apache-server_root_relative(); not found

2002-06-04 Thread m31

Stas Bekman wrote:

On Mon, 3 Jun 2002, m31 wrote:

Yes, I'm running it under mod_perl/1.27 which I compiled as a DSO with 
apxs. This also gave me errors under 1.25, I just pushed @INC to solve 
it but I would like to use server_root_relative. I have it in a startup 
script, the one from the eagle book. It goes like:
#! /usr/bin/perl

BEGIN {
use Apache ();
use lib Apache-server_root_relative('lib/perl');
}

use Apache::Registry  ();
use Apache::Constants ();
use CGI qw(-compile :all);
use CGI::Carp ();
use DBI ();
1;

Which I had it to change to: push(@INC, '/Library/www/lib/perl'); 
because the server_root_relative gave me errors. I read some where that 
in order to test with startup scripts you need to use the 
Apache::FakeRequest? Even if so, if I ignore the errors and just restart 
apache, it wont find 'lib/perl', so I have to push @INC manually then do 
a graceful restart for it to work. I am running OSX 10.1.4/Darwin. Dont 
think that has anything to do with it though.


There are two separate issues here:

1. you try to test perl code which only runs under mod_perl. but according 
to your report you don't have a problem calling server_root_relative() 
when you start the server. So this is not a problem, right?

2. your problem is that Apache-server_root_relative('lib/perl') doesn't 
return what you expect. Is your ServerRoot set to '/Library/www'?


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org 
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com  
http://modperlbook.org http://apache.org   http://ticketmaster.com


Thank you all for your help. You are correct, I didn't dawn on me that 
my ServerRoot is somewhat different than my document root. I was 
expecting it to return my documenrt root.
(embarasment...hence SERVER_ROOT_relative())
Well, I printed out my @INC to screen, and now I have directories that 
do not exist in it from putting the wrong path in the 
server_root_relative method, can any-one tell me how to remove this dir 
from @INC?  I treid a few ways but to no sucess.


Please be patient with idiocracy, I'm just a student trying to get ahead.





Re: Apache-server_root_relative(); not found

2002-06-04 Thread Stas Bekman

m31 wrote:
 Thank you all for your help. You are correct, I didn't dawn on me that 
 my ServerRoot is somewhat different than my document root. I was 
 expecting it to return my documenrt root.
 (embarasment...hence SERVER_ROOT_relative())
 Well, I printed out my @INC to screen, and now I have directories that 
 do not exist in it from putting the wrong path in the 
 server_root_relative method, can any-one tell me how to remove this dir 
 from @INC?  I treid a few ways but to no sucess.

Please be more specific. What have you done to @INC so it includes 
non-existing dirs? You must have added them. A *short* code fragment is 
the best so we can reproduce the problem.

 Please be patient with idiocracy, I'm just a student trying to get ahead.

Don't worry :) Just try to provide more details in first place, so there 
will be less ping-pong emails here.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Re: Apache-server_root_relative(); not found

2002-06-04 Thread Per Einar Ellefsen

At 13:30 04.06.2002, m31 wrote:
Well, I printed out my @INC to screen, and now I have directories that do 
not exist in it from putting the wrong path in the server_root_relative 
method, can any-one tell me how to remove this dir from @INC?  I treid a 
few ways but to no sucess.

Restart your server? use lib doesn't make any permanent changes to @INC, 
these only persist across the httpd mod_perl run. If you restart (with the 
correct code this time), it should be set to the correct value.


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Re: Apache-server_root_relative(); not found

2002-06-04 Thread m31

Per Einar Ellefsen wrote:

 At 13:30 04.06.2002, m31 wrote:

 Well, I printed out my INC to screen, and now I have directories 
 that do not exist in it from putting the wrong path in the 
 server_root_relative method, can any-one tell me how to remove this 
 dir from INC?  I treid a few ways but to no sucess.


 Restart your server? use lib doesn't make any permanent changes to 
 INC, these only persist across the httpd mod_perl run. If you restart 
 (with the correct code this time), it should be set to the correct value.

Per Einar,
Yes, I restarted it. I have INC printed out to the screen in one of my 
test modules, and after a restart the dir's are still there so I opened 
up a terminal window and did a:
perl -le 'print join \n, INC'
and the dir's I would like to pop off INC aren't listed but they are 
listed in my browser from the module? I now realize that I can't change 
my ServerRoot in httpd.conf because then apache won't be able to load 
any of its modules at startup (in /usr/libexec/httpd).

So I have three choices
1.) Get the Apache source, compile and install where I need it. Instead 
of the using one that comes with OSX.
2.) move the modules I build for mod_perl somewhere under the /usr 
directory. (my doc root is /Library/www/docs Apple sets this up in two 
totaly diff tree's)
3.) keep the modules where they are and just push(INC, 
'/Library/www/lib'); instead of using use lib 
Apache-server_root_relative('lib/perl'); (actually returns 
/usr/lib/perl in stead of what I need, /Library/www/lib/perl)

Well, I'm not sure what I'll do yet, its only a developement machine for 
educational purposes thankx for the help
-Justin

Stas Beckman,
Thankx for your help also.
Stas wrote:
Please be more specific. What have you done to INC so it includes 
non-existing dirs? You must have added them. A *short * code fragment is 
the best so we can reproduce the problem.
The code snippet for the startup file I used is on one of the other 
emails/replies.
I think we've narrowed it down to three choices, but why would my INC 
list one thing from the terminal and another from mod_perl? Are they two 
seperate INC's?




Re: Apache-server_root_relative(); not found

2002-06-04 Thread Stas Bekman

m31 wrote:

 I think we've narrowed it down to three choices, but why would my @INC 
 list one thing from the terminal and another from mod_perl? Are they two 
 seperate @INC's?

mod_perl adds a few dirs to @INC on its own, but I still cannot 
understand what is your problem. Let's say you want to add 
'/Library/www/lib' to @INC. So inside startup.pl you do:

use lib qw(/Library/www/lib);

and that's it!

Remember that you cannot affect @INC for the whole server from your 
handlers/scripts, as it gets reset after each request to the value it 
had after startup, so you can only change it during startup.

-- 


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Apache-server_root_relative(); not found

2002-06-03 Thread Stas Bekman

m31 wrote:
 HI, sorry if this is the wrong place, I am new to the mailing list.

This is the right place. If you are new to mod_perl, you probably want 
to read the docs first. See: http://perl.apache.org/release/docs/

 I have apache/1.3.23 and mod_perl/1.27 (I just upgraded) and perl/5.6.0
 
 When I try:
 
 BEGIN {
use Apache ();
use lib Apache-server_root_relative('lib/perl');
 }
 
 I get compilation errors saying that it can't locate object method 
 server_root_relative via pachage Apache. BEGIN failed.
 
 Can any-one help me out or point me in the right direction?

Are you sure you are testing this under mod_perl? Also please be more 
specific, where did you put this code: in a startup file, a script or a 
handler?

You cannot test code including Apache API without running under mod_perl.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Apache-server_root_relative(); not found

2002-06-03 Thread m31

Yes, I'm running it under mod_perl/1.27 which I compiled as a DSO with 
apxs. This also gave me errors under 1.25, I just pushed INC to solve 
it but I would like to use server_root_relative. I have it in a startup 
script, the one from the eagle book. It goes like:
#! /usr/bin/perl

BEGIN {
use Apache ();
use lib Apache-server_root_relative('lib/perl');
}

use Apache::Registry  ();
use Apache::Constants ();
use CGI qw(-compile :all);
use CGI::Carp ();
use DBI ();
1;

Which I had it to change to: push(INC, '/Library/www/lib/perl'); 
because the server_root_relative gave me errors. I read some where that 
in order to test with startup scripts you need to use the 
Apache::FakeRequest? Even if so, if I ignore the errors and just restart 
apache, it wont find 'lib/perl', so I have to push INC manually then do 
a graceful restart for it to work. I am running OSX 10.1.4/Darwin. Dont 
think that has anything to do with it though.




Re: Apache-server_root_relative(); not found

2002-06-03 Thread Stas Bekman

On Mon, 3 Jun 2002, m31 wrote:

 Yes, I'm running it under mod_perl/1.27 which I compiled as a DSO with 
 apxs. This also gave me errors under 1.25, I just pushed @INC to solve 
 it but I would like to use server_root_relative. I have it in a startup 
 script, the one from the eagle book. It goes like:
 #! /usr/bin/perl
 
 BEGIN {
 use Apache ();
 use lib Apache-server_root_relative('lib/perl');
 }
 
 use Apache::Registry  ();
 use Apache::Constants ();
 use CGI qw(-compile :all);
 use CGI::Carp ();
 use DBI ();
 1;
 
 Which I had it to change to: push(@INC, '/Library/www/lib/perl'); 
 because the server_root_relative gave me errors. I read some where that 
 in order to test with startup scripts you need to use the 
 Apache::FakeRequest? Even if so, if I ignore the errors and just restart 
 apache, it wont find 'lib/perl', so I have to push @INC manually then do 
 a graceful restart for it to work. I am running OSX 10.1.4/Darwin. Dont 
 think that has anything to do with it though.

There are two separate issues here:

1. you try to test perl code which only runs under mod_perl. but according 
to your report you don't have a problem calling server_root_relative() 
when you start the server. So this is not a problem, right?

2. your problem is that Apache-server_root_relative('lib/perl') doesn't 
return what you expect. Is your ServerRoot set to '/Library/www'?


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org 
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com  
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Apache-server_root_relative(); not found

2002-06-03 Thread Per Einar Ellefsen

At 02:16 04.06.2002, m31 wrote:
I am running OSX 10.1.4/Darwin. Dont think that has anything to do with it 
though.

It might. It has been stated on the dev list that the lib pragma has a 
problem under Darwin. Could you try:
BEGIN {
 unshift @INC, Apache-server_root_relative('lib/perl');
}

?


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Re: Apache-server_root_relative not found?

2000-12-21 Thread Doug MacEachern

On Mon, 27 Nov 2000, The BOFH wrote:
 
 BEGIN {
use Apache ();
use lib Apache-server_root_relative('libperl');   ## 
 /usr/local/apache/libperl created
 }
... 
 perl -cw modperl_startup.pl returns:
 
 Can't locate object method "server_root_relative" via package "Apache" at 
 conf/modperl_startup.pl line 5.  mod_perl was built with EVERYTHING=1.

Apache- methods are only available inside the server, not on the command
line.  perl -c will pass if you remove the BEGIN block, which is not
required in either case.