Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: mod_perl Apache::Request vs Apache->request

by edoc (Chaplain)
on Jan 21, 2004 at 22:36 UTC ( #323047=note: print w/replies, xml ) Need Help??

in reply to mod_perl Apache::Request vs Apache->request

I think I know where you're at, and you could probably work around it in some way, but I would sugest modularising your code further.. Your upload module should be just that, not a handler. It should take $r as an arg and operate on that. Then you can call that module from any handler that needs it.

ps. You should also be using Apache::Request->instance but I'm not sure that that will solve your immediate problem.



  • Comment on Re: mod_perl Apache::Request vs Apache->request

Replies are listed 'Best First'.
Re: Re: mod_perl Apache::Request vs Apache->request
by drfrog (Deacon) on Jan 21, 2004 at 23:02 UTC
    ok i have more time now to show more code!

    first listing is the Add which should be able to be accessed by either the second listing or the location handler like in the third listing
    **-- listing 1----** package MyMod::Add; use strict; use warnings; sub handler { my $r = Apache->request; my %args = $r->args; &Add($r); } sub Add { my $r = shift; my %args = $r->args; ..... } **---listing 2----** package MyMod::Uploads; use strict; use warnings; use MyMod::Add; use LWP::Simple; use URI::Escape; sub handler { # Standard stuff, with added options... my $r = Apache::Request->new( shift, POST_MAX => 10 * 1024 * 1024, # in bytes, + so 10M DISABLE_UPLOADS => 0 ); if ($r->upload){ upload($r); } } sub upload { foreach my $upload ( $r->upload ) { ##parse upload &MyMod::Add::Add($r); } } **---listing 3---** in httpd.conf: <Location /add> SetHandler perl-script PerlHandler MyMod::Add </Location>
    how can i do both? i know its possible without the upload scenario

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2022-01-17 00:44 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (50 votes). Check out past polls.