Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Re: Re: Apache conflicts with my modules

by IOrdy (Friar)
on Aug 29, 2001 at 18:03 UTC ( [id://108754]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Apache conflicts with my modules
in thread Apache conflicts with my modules

I was told I should be using Apache::Request for things like:
my $r = Apache->request; my $apr = Apache::Request->instance($r, DISABLE_UPLOADS => 1); my $args = $apache_request->param;
Someone (I think it was on here) said it was better/safer than using just $r as I could set stuff like DISABLE_UPLOADS and the max size for post/get requests.

What is it with shift? To tell you the truth I dont understand how it can be use in such an instance. I know that it returns & removes the first argument in an array ie. @ARGV , @_ or @whatever. I know that Apache wraps your script so that having it in my script (not a sub) should return the class name i.e Apache but why can it replace Apache->request which I thought would be a subroutine?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Apache conflicts with my modules
by echo (Pilgrim) on Aug 29, 2001 at 18:24 UTC
    Hi again! Your reasons for using Apache::Request are valid. I just wanted to make sure you had a purpose...

    About my $r = shift;: when you use Apache::Registry or Apache::PerlRun to run a script under mod_perl, it is wrapped in a sub, and the first argument provided is the request object. Is is just a convenient shortcut provided by mod_perl. The request object is created by mod_perl when the request comes in, long before your script is actually called. There is only one instance of the request object for the whole lifetime of the request.

    To further debug your Apache::Request problem, I suggest commenting it out and see if your script runs fine without it. This would help to isolate the cause of the error.

    Change:

    $apr = Apache::Request->new($r, DISABLE_UPLOADS => 1); my $args = $apache_request->param;
    to
    my %args = $r->method eq 'GET' ? $r->args : $r->content;
    and see what happens.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://108754]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-03-28 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found