Any way for a PerlHandler to know what Location block it's in?

2005-06-08 Thread John Siracusa
Confusing subject, simple question:

Location /foo/bar
  PerlSetVar  MyRoot /foo/bar
  SetHandler  perl-script
  PerlHandler MyModule
/Location

MyModule calls $r-dir_config('MyRoot') to get the /foo/bar path.

I want to ditch the  PerlSetVar MyRoot line because it will always have
the same value as the Location directiv above it.  Is there a way MyModule
can get /foo/bar using some other means?

(This is mod_perl 1, BTW)

-John




Re: Any way for a PerlHandler to know what Location block it's in?

2005-06-08 Thread Michael Peters
John Siracusa wrote:
 Confusing subject, simple question:
 
 Location /foo/bar
   PerlSetVar  MyRoot /foo/bar
   SetHandler  perl-script
   PerlHandler MyModule
 /Location
 
 MyModule calls $r-dir_config('MyRoot') to get the /foo/bar path.
 
 I want to ditch the  PerlSetVar MyRoot line because it will always have
 the same value as the Location directiv above it.  Is there a way MyModule
 can get /foo/bar using some other means?

I feel almost silly saying this, but did you look at $r-location?
http://perl.apache.org/docs/1.0/api/Apache.html#_r_E_gt_location

-- 
Michael Peters
Developer
Plus Three, LP



Re: Any way for a PerlHandler to know what Location block it's in?

2005-06-08 Thread John Siracusa
On 6/8/05, Geoffrey Young [EMAIL PROTECTED] wrote:
 $r-location() ?

Duh, I'm an idiot.  Thanks :)

-John




Re: Any way for a PerlHandler to know what Location block it's in?

2005-06-08 Thread Dorian Taylor
On Wed, Jun 08, 2005 at 12:00:23PM -0400, John Siracusa wrote:
 On 6/8/05, Geoffrey Young [EMAIL PROTECTED] wrote:
  $r-location() ?
 
 Duh, I'm an idiot.  Thanks :)
 
 -John

$r-location will also return whatever's in a LocationMatch, Directory
and DirectoryMatch directive, should the scope of the request lay
in one of those. if you're simply clipping the location off the
front of the request uri you could potentially run into trouble.
you can always piggyback the Location directive specifically, using
the configuration api and use what you get back from that.

.d


[ANNOUNCE] Apache2::TrapSubRequest 0.03

2005-06-08 Thread Dorian Taylor
http://search.cpan.org/~dorian/ - now with working tests.

0.03 should show up soon (forgot to remove the bit about ap_save_brigade
in 0.02)


Re: Any way for a PerlHandler to know what Location block it's in?

2005-06-08 Thread John Siracusa
On 6/8/05, Dorian Taylor [EMAIL PROTECTED] wrote:
 $r-location will also return whatever's in a LocationMatch, Directory
 and DirectoryMatch directive, should the scope of the request lay
 in one of those. if you're simply clipping the location off the
 front of the request uri you could potentially run into trouble.
 you can always piggyback the Location directive specifically, using
 the configuration api and use what you get back from that.

Thanks.  I realize that, but I only need it to work specifically for plain
old Location blocks.  I have sanity checks to make sure it really is a
prefix of the requested URI since I am indeed clipping it off the URI.

None of these paths have any representation in the file system, so path_info
is no help.  I thought about wandering the apache config using perl's
interface to that info but it seemed like too much trouble.  Is there a
better way to get the rest of the URI?

-John




Can't load perl file

2005-06-08 Thread Nick Pietraniec

Hello everyone,

Hoping someone out has experienced this before.  I've poured through 
archives and faqs but haven't seen any info on it.  I just tried 
everything below on a clean server because I thought I messed something 
up during an upgrade, but I'm getting this on more than one computer.


I'm trying to set up apache 2 (2.0.54) on Windows 2000 Server

with SSL (from here -- currently working)
http://smithii.com/?q=node/view/30

The latest version of ActivePerl (5.8.7.813)

and...  mod_perl, which I've installed via the mpinstall script here..
http://perl.apache.org/docs/2.0/os/win32/install.html#PPM_Packages

I've got



LoadFile C:/Perl/bin/perl58.dll
LoadModule perl_module modules/mod_perl.so

PerlRequire c:/Apache2/conf/mod_perl.pl

---

Directly below all the other LoadModule directives in httpd.conf
and when I try to start Apache I get

[Wed Jun 08 14:06:16 2005] [error] Can't load Perl file: 
c:/Apache2/conf/mod_perl.pl for server www.mysite.com:80, exiting...


(Yes the file is there)

but - if I instead put in

--

PerlSwitches -IC:/Perl/site/lib/bundle

LoadFile C:/Perl/bin/perl58.dll
LoadModule perl_module modules/mod_perl.so

Perlmodule Apache2
PerlModule Apache2::compat



Below all the other LoadModule directives, it seems to start fine.
I'm no perl guru - I won't pretend to know how to properly set this up
Does anyone out there see what I'm missing or doing wrong?

Thanks in advance...

-Nick


Re: [ANNOUNCE] Apache2::TrapSubRequest 0.03

2005-06-08 Thread Joe Schaefer
Dorian Taylor [EMAIL PROTECTED] writes:

 http://search.cpan.org/~dorian/ - now with working tests.

 0.03 should show up soon (forgot to remove the bit about
 ap_save_brigade in 0.02)

Hmm, have you considered removing the _filter sub and writing 
it as a closure instead?  Here's some code that I've been using 
for that:

 use base Apache2::Filter;
 ...
 my $content = ;
 $subr-add_output_filter(bless sub : FilterRequestHandler {
   my ($f, $bb) = @_;
   while (my $e = $bb-first) {
   $e-read(my $buf);
   $content .= $buf;
   $e-delete;
   }
   return Apache2::Const::OK;
 });

$subr-run; # reads entire subrequest into $content

This way your subrequest buckets are all consumed by the filter,
and you don't need a pnote to store the captured subrequest 
(I really don't know why you want to use ap_save_brigade). IMO 
dynamically creating filters using closures is a really nifty 
feature of mod_perl2; I use it to postprocess stuff stored
inside a mod_authz_svn-protected subversion repository. Just *try* 
getting the authz info correct with a plain-old CGI script :-).

-- 
Joe Schaefer



Re: Can't load perl file

2005-06-08 Thread Tom Schindl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick Pietraniec schrieb:
[...]
| 
|
| LoadFile C:/Perl/bin/perl58.dll
~   ^^^
| LoadModule perl_module modules/mod_perl.so
|
| PerlRequire c:/Apache2/conf/mod_perl.pl
~  ^^^
|
| ---

Does the lower letter of c: matter. I'm not using win32 which is
normally case in sensitive but who knows ...
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCp2mqkVPeOFLgZFIRAnj8AJ47iAyQq9MWb2YY/DTrbphWfaGdnACcDrmG
MTqOIGg4N7AeCDRxHj9G8d0=
=OlQ+
-END PGP SIGNATURE-


Re: Can't load perl file

2005-06-08 Thread Nick Pietraniec

Not a bad idea, but I just gave it a shot and no luck.


On Jun 8, 2005, at 2:56 PM, Tom Schindl wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick Pietraniec schrieb:
[...]
| 
|
| LoadFile C:/Perl/bin/perl58.dll
~   ^^^
| LoadModule perl_module modules/mod_perl.so
|
| PerlRequire c:/Apache2/conf/mod_perl.pl
~  ^^^
|
| ---

Does the lower letter of c: matter. I'm not using win32 which is
normally case in sensitive but who knows ...
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCp2mqkVPeOFLgZFIRAnj8AJ47iAyQq9MWb2YY/DTrbphWfaGdnACcDrmG
MTqOIGg4N7AeCDRxHj9G8d0=
=OlQ+
-END PGP SIGNATURE-




Re: [ANNOUNCE] Apache2::TrapSubRequest 0.03

2005-06-08 Thread Dorian Taylor
 Hmm, have you considered removing the _filter sub and writing 
 it as a closure instead?  Here's some code that I've been using 
 for that:

i suppose i could do that. today is clean-my-modules-and-get-them-on-cpan
day so perhaps later. ;)

.d


testing against both apache 1.x and 2.x

2005-06-08 Thread Dorian Taylor
so i'm working on one of my modules that works in both mod_perl 1
and 2, (custom config directives, conditional makefile processing,
the whole nine) and i realized i have to test against both apache
1 and 2, preferably in one sequence. now, there's APACHE_TEST_APXS,
APACHE_TEST_HTTPD and whatnot, but what would be a sane way to go
about retrieving both to do a single test run?

.d


Re: testing against both apache 1.x and 2.x

2005-06-08 Thread Stas Bekman

Dorian Taylor wrote:

so i'm working on one of my modules that works in both mod_perl 1
and 2, (custom config directives, conditional makefile processing,
the whole nine) and i realized i have to test against both apache
1 and 2, preferably in one sequence. now, there's APACHE_TEST_APXS,
APACHE_TEST_HTTPD and whatnot, but what would be a sane way to go
about retrieving both to do a single test run?


I suppose you need to run the first part of the test then reconfigure the 
server, restart it and run the second part. Torsten was working on such a 
feature for Apache-Test, as you can see:

http://marc.theaimsgroup.com/?l=apache-modperl-test-devm=111639898317619w=2

I'm not sure why he didn't followup on that message with an updated patch, 
so it is still uncommitted. Torsten?


--
__
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: Can't load perl file

2005-06-08 Thread Nick Pietraniec

Turns out it was an error in the mod_perl.pl file

I took Can't load to mean Where's this file?  Where I should have 
taken it as There's an error in this file



On Jun 8, 2005, at 3:00 PM, Nick Pietraniec wrote:


Not a bad idea, but I just gave it a shot and no luck.


On Jun 8, 2005, at 2:56 PM, Tom Schindl wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick Pietraniec schrieb:
[...]
| 
|
| LoadFile C:/Perl/bin/perl58.dll
~   ^^^
| LoadModule perl_module modules/mod_perl.so
|
| PerlRequire c:/Apache2/conf/mod_perl.pl
~  ^^^
|
| ---

Does the lower letter of c: matter. I'm not using win32 which is
normally case in sensitive but who knows ...
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCp2mqkVPeOFLgZFIRAnj8AJ47iAyQq9MWb2YY/DTrbphWfaGdnACcDrmG
MTqOIGg4N7AeCDRxHj9G8d0=
=OlQ+
-END PGP SIGNATURE-




Re: Can't load perl file

2005-06-08 Thread Foo Ji-Haw
What is in your mod_perl.pl file? If there is any error returned during 
compilation of the script, you will get the error you got . Try running 
mod_perl.pl from the command line, if it is possible. A possibility is 
that you forgot to 'use Apache2' in your script.


Nick Pietraniec wrote:


Hello everyone,

Hoping someone out has experienced this before.  I've poured through 
archives and faqs but haven't seen any info on it.  I just tried 
everything below on a clean server because I thought I messed 
something up during an upgrade, but I'm getting this on more than one 
computer.


I'm trying to set up apache 2 (2.0.54) on Windows 2000 Server

with SSL (from here -- currently working)
http://smithii.com/?q=node/view/30

The latest version of ActivePerl (5.8.7.813)

and...  mod_perl, which I've installed via the mpinstall script here..
http://perl.apache.org/docs/2.0/os/win32/install.html#PPM_Packages

I've got



LoadFile C:/Perl/bin/perl58.dll
LoadModule perl_module modules/mod_perl.so

PerlRequire c:/Apache2/conf/mod_perl.pl
---

Directly below all the other LoadModule directives in httpd.conf
and when I try to start Apache I get

[Wed Jun 08 14:06:16 2005] [error] Can't load Perl file: 
c:/Apache2/conf/mod_perl.pl for server www.mysite.com:80, exiting...


(Yes the file is there)

but - if I instead put in

--

PerlSwitches -IC:/Perl/site/lib/bundle

LoadFile C:/Perl/bin/perl58.dll
LoadModule perl_module modules/mod_perl.so

Perlmodule Apache2
PerlModule Apache2::compat


Below all the other LoadModule directives, it seems to start fine.
I'm no perl guru - I won't pretend to know how to properly set this up
Does anyone out there see what I'm missing or doing wrong?

Thanks in advance...

-Nick



Re: Can't load perl file

2005-06-08 Thread Foo Ji-Haw
Yes. When it fails to compile, it returns exactly that 'Can't load...' 
message.


Nick Pietraniec wrote:


Turns out it was an error in the mod_perl.pl file

I took Can't load to mean Where's this file?  Where I should have 
taken it as There's an error in this file



On Jun 8, 2005, at 3:00 PM, Nick Pietraniec wrote:


Not a bad idea, but I just gave it a shot and no luck.


On Jun 8, 2005, at 2:56 PM, Tom Schindl wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick Pietraniec schrieb:
[...]
| 
|
| LoadFile C:/Perl/bin/perl58.dll
~   ^^^
| LoadModule perl_module modules/mod_perl.so
|
| PerlRequire c:/Apache2/conf/mod_perl.pl
~  ^^^
|
| ---

Does the lower letter of c: matter. I'm not using win32 which is
normally case in sensitive but who knows ...
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCp2mqkVPeOFLgZFIRAnj8AJ47iAyQq9MWb2YY/DTrbphWfaGdnACcDrmG
MTqOIGg4N7AeCDRxHj9G8d0=
=OlQ+
-END PGP SIGNATURE-