Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

Apache2::Request

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


pinate11 at yahoo

May 23, 2008, 1:49 AM

Post #1 of 5 (542 views)
Permalink
Apache2::Request

Hi,

I am trying to use mod_perl2 with Apache2::Request. My intention is to get
parameter value of post method. As described in its document and previouse
threads said to cache the data with post method...
"....Use Apache2::Request in the auth handler, and apreq
will do the SOMETHING you need automatically."

My existing code i.e. handler begins with
sub my_handler {
my $self = shift;
my $r = shift;
....
...
I guess that $r refers to Apache2::RequestRec object because the lines
that follows use methods of this object.

With the little knowledge, I don't know why calling $r = shift returns
Apache2::RequestRec.
How can I make use Apache2::Request in my handler so I can preseve the
parameter via post method?

I tried the following line without success

sub my_handler {
my $self = shift;
my $r = shift;
my $req = Apache2::Request->new($r, POST_MAX => "1M");
...
...
}
Please advice.

PA










--
View this message in context: http://www.nabble.com/Apache2%3A%3ARequest-tp17420698p17420698.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


xyon at indigorobot

May 23, 2008, 4:59 AM

Post #2 of 5 (508 views)
Permalink
Re: Apache2::Request [In reply to]

Shouldn't it be:

sub my_handler {
my $r = shift;
my $req = Apache2::Request->new($r, POST_MAX => "1M");
...


On Friday 23 May 2008 04:49:55 mome wrote:
> Hi,
>
> I am trying to use mod_perl2 with Apache2::Request. My intention is to get
> parameter value of post method. As described in its document and previouse
> threads said to cache the data with post method...
> "....Use Apache2::Request in the auth handler, and apreq
> will do the SOMETHING you need automatically."
>
> My existing code i.e. handler begins with
> sub my_handler {
> my $self = shift;
> my $r = shift;
> ....
> ...
> I guess that $r refers to Apache2::RequestRec object because the lines
> that follows use methods of this object.
>
> With the little knowledge, I don't know why calling $r = shift returns
> Apache2::RequestRec.
> How can I make use Apache2::Request in my handler so I can preseve the
> parameter via post method?
>
> I tried the following line without success
>
> sub my_handler {
> my $self = shift;
> my $r = shift;
> my $req = Apache2::Request->new($r, POST_MAX => "1M");
> ...
> ...
> }
> Please advice.
>
> PA



--

xyon


adam.prime at utoronto

May 23, 2008, 7:29 AM

Post #3 of 5 (504 views)
Permalink
Re: Apache2::Request [In reply to]

Quoting xyon <xyon[at]indigorobot.com>:

> Shouldn't it be:
>
> sub my_handler {
> my $r = shift;
> my $req = Apache2::Request->new($r, POST_MAX => "1M");
> ...
>

Provided that you've actually installed libapreq
(http://httpd.apache.org/apreq/), that should work.


perrin at elem

May 23, 2008, 10:01 AM

Post #4 of 5 (503 views)
Permalink
Re: Apache2::Request [In reply to]

On Fri, May 23, 2008 at 4:49 AM, mome <pinate11[at]yahoo.com> wrote:
> I tried the following line without success
>
> sub my_handler {
> my $self = shift;
> my $r = shift;
> my $req = Apache2::Request->new($r, POST_MAX => "1M");

You only want that additional shift at the beginning if you are
calling your handler as a method. You probably aren't, since you
don't have a "method" sub attribute here. That means that the request
object ($r) will be the first thing passed, not the second. There is
no $self when calling handlers as subs.

- Perrin


jdrago_999 at yahoo

May 23, 2008, 10:30 AM

Post #5 of 5 (492 views)
Permalink
Re: Apache2::Request [In reply to]

--- adam.prime[at]utoronto.ca wrote:

> Quoting xyon <xyon[at]indigorobot.com>:
>
> > Shouldn't it be:
> >
> > sub my_handler {
> > my $r = shift;
> > my $req = Apache2::Request->new($r, POST_MAX =>
> "1M");
> > ...
> >
>
> Provided that you've actually installed libapreq
> (http://httpd.apache.org/apreq/), that should work.
>
>


Your mod_perl handler is passed either 1 or 2
parameters, depending on how you declare your method.

Example:

sub handler {
my ($r) = @_;
}


sub handler : method {
my ($class, $r) = @_;
}

In either case, $r is an Apache2::RequestRec. The
difference is the ": method" attribute that tells
mod_perl to pass your "handler" sub 2 parameters
instead of just 1.

- John Drago
http://www.devstack.com
http://search.cpan.org/dist/Apache2-ASP

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.