You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Glenn E. Bailey III" <gb...@sprocketdata.com> on 2003/07/30 15:47:24 UTC
PerlTransHandler headaches
Hello,
While I am not new to Perl, I am completely new to mod_perl. I have
a client I am working on moving a project that runs under mod_perl.
He does alot manipulation with the PerlTransHandler stuff. Well,
even on a default mod_perl install, with a default Apache install, I
can not get the darn thing to work for the life of me. Here is the
simple script I am using to test with:
use Apache::Constants qw|OK DECLINED REDIRECT M_GET|;
use strict;
use warnings;
sub handler {
my $r = shift;
return OK;
}
1;
And not matter what I always get a 404 with the following in the log:
[Tue Jul 29 03:27:27 2003] [error] [client 10.0.0.1] File does not
exist: /
Any suggestions on where to start looking? The original coder of the
project has left the client and is nowhere to be found, fun fun .. ;-)
RE: PerlTransHandler headaches
Posted by "Glenn E. Bailey III" <gb...@sprocketdata.com>.
: don't forget, you can't just change handlers and expect them
: to work -
This is probably what has been messing me up. Doing a quick stop
and restart of Apache after any change I made seems to have fixed
my problems, do! Thanks for your help ;-)
. Glenn E. Bailey III
. Network Solutions Developer
. Sprocket Data, Inc.
Re: PerlTransHandler headaches
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> : so, the general rule for PerlTransHandlers is to return
> : DECLINED unless you
> : set $r->filename.
>
> What I am trying to do is just test, to make sure it is working
> ok. So what I did is wrote the following snippit:
>
> sub handler {
> my $r = shift;
> return DECLINED;
> }
>
> That should still allow me to pull up my default content, correct? As
> of now it still gives me a 404 ..
make sure the request works without the PerlTransHandler installed first.
if it does, then adding that routine should be ok.
don't forget, you can't just change handlers and expect them to work -
because the code is loaded the first time it's seen and not on every
request, you either need to install Apache::StatINC, Apache::Reload, set
PerlFreshRestart On and restart the server or (simplest) fully shutdown and
startup the server.
--Geoff
RE: PerlTransHandler headaches
Posted by "Glenn E. Bailey III" <gb...@sprocketdata.com>.
: check out the resources at http://perl.apache.org/ - there's
: lots of good
: information there :)
Heh, only found one document there concerning the TransHandler
stuff ..
: so, the general rule for PerlTransHandlers is to return
: DECLINED unless you
: set $r->filename.
What I am trying to do is just test, to make sure it is working
ok. So what I did is wrote the following snippit:
sub handler {
my $r = shift;
return DECLINED;
}
That should still allow me to pull up my default content, correct? As
of now it still gives me a 404 ..
Re: PerlTransHandler headaches
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Glenn E. Bailey III wrote:
> Hello,
>
> While I am not new to Perl, I am completely new to mod_perl.
check out the resources at http://perl.apache.org/ - there's lots of good
information there :)
> sub handler {
> my $r = shift;
> return OK;
> }
> 1;
>
> And not matter what I always get a 404 with the following in the log:
>
> [Tue Jul 29 03:27:27 2003] [error] [client 10.0.0.1] File does not
> exist: /
the translation phase is there to map the URI to a filename. by returning
OK, you're telling Apache that you've done the translation (that is, you
have set $r->filename to something useful). since you didn't set
$r->filename, apache is returning 404, since it can't serve the value of
$r->filename.
so, the general rule for PerlTransHandlers is to return DECLINED unless you
set $r->filename.
chapter 12 in the mod_perl Developer's Cookbook deals specifically with the
PerlTransHandler and is as good a place to start learning as any.
HTH
--Geoff