perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: Apache::Request vs Apache->request
Date Mon, 26 Jan 2004 20:03:40 GMT
Clayton Cottingham wrote:
> while i understand the difference between these two i am unsure how to
> handle these back and forth. let me explain:

There are not the same thing.

> I have an upload module with the handler using an Apache::Request
>    my $r = Apache::Request->new(
>         shift,
>         POST_MAX        => 10 * 1024 * 1024,    # in bytes, so 10M
>         DISABLE_UPLOADS => 0
>     );

Here $r is a subclass of Apache, so you can do operations as before and plus 
new A::R methods.

> later on i want to send all the info recieved from a file to another
> module that inserts this information into a database table
> 
> rather than pass through a  LWP::Simple::get call i would like to call
> the  subroutine that handles the logic directly like so:
> 
> &MYMod::Add::Add($r);
> 
> BUT i have the above subroutine pulling in the Apache->request object if
> through MYMod::Add::handler
> 
> 
> so i tried something like this in my upload module
> 
> 
>  my $r = Apache->request;

this is a plain $r.

>     # Standard stuff, with added options...
>     my $apr = Apache::Request->new(
>         $r,
>         POST_MAX        => 10 * 1024 * 1024,    # in bytes, so 10M
>         DISABLE_UPLOADS => 0
>     );

$apr is a subclassed object that know to do more than $r.

> and then 
> &MYMod::Add::Add($r);
> 
> but this just borks out the uplaod procedure
 >
> and nothing get processed, whereas if i just pass in the Apache::Request
> it doesnt process the parameters correctly

so you need to pass $apr. $r is still an Apache object, not an Apache::Request 
one. Apache::Request->new() doesn't affect $r in your code above.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Mime
View raw message