You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jonathan Mangin <jo...@comcast.net> on 2007/01/18 22:37:53 UTC

Catching errors

I'm hitting a location on my server with:

http://zeppo/time?fname=Jonathan&lname=Mangin&foo=George


#use APR::Const -compile => qw(:common :error);
use APR::Const qw(:common :error);

sub handler {
   my $r = shift;
   my $req = Apache2::Request->new($r);
   my $foo;
#   eval {$foo = $req->param('foo')};
   $foo = $req->param('foo');
   my $args_error = $req->args_status();
   my $body_error = $req->body_status();
   my $param_error = $req->param_status();

Whether $foo is defined or not (using eval or not)
$args_error is always defined as 'Error 0' and 
the other two are 'Missing input data'.  How does
it know that input data is missing?  What am I doing
so wrong that I never get APR_SUCCESS?

Thanks,
Jon


Re: Catching errors

Posted by Jonathan Mangin <jo...@comcast.net>.
----- Original Message ----- 
From: "Robert Landrum" <rl...@aol.net>
To: "Jonathan Mangin" <jo...@comcast.net>
Cc: <mo...@perl.apache.org>
Sent: Thursday, January 18, 2007 7:08 PM
Subject: Re: Catching errors


> Jonathan Mangin wrote:
> > 
> > sub handler {
> >    my $r = shift;
> >    my $req = Apache2::Request->new($r);
> >    my $foo;
> > #   eval {$foo = $req->param('foo')};
> >    $foo = $req->param('foo');
> 
> You might want to make sure $r is really $r.  If you configure apache 
> such that you use PerlHandler Foo->handler, I believe the first argument 
> is 'Foo', followed by $r.
> 
> Rob

$r is really $r.  I'm sending it to the template and printing
selected bits.  So hitting

http://zeppo/time?foo=George

$req->args_status returns 'Error 0'.  What module is producing
'Error 0' and what does it mean?

--Jon



Re: Catching errors

Posted by Robert Landrum <rl...@aol.net>.
Jonathan Mangin wrote:
> 
> sub handler {
>    my $r = shift;
>    my $req = Apache2::Request->new($r);
>    my $foo;
> #   eval {$foo = $req->param('foo')};
>    $foo = $req->param('foo');

You might want to make sure $r is really $r.  If you configure apache 
such that you use PerlHandler Foo->handler, I believe the first argument 
is 'Foo', followed by $r.

Rob