Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: mod_perl and forwarding legacy functions to a global object

by Juerd (Abbot)
on Jun 25, 2004 at 17:51 UTC ( #369689=note: print w/replies, xml ) Need Help??


in reply to mod_perl and forwarding legacy functions to a global object

How can I create a $new_obj for every request in the Legacy package or otherwise solve my problem?

First, I have to say that global objects are imho no better than just a bunch of subs that share variables.

To answer your question: the easiest way is to subclass the handler you're using. For instance, to subclass Apache::Registry:

package Apache::Registry::ThinkOfANiceName; use base 'Apache::Registry'; sub handler { my $r = shift; local $Legacy::new_obj = New->new; $r->SUPER::handler(@_); } 1;

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2019-11-16 23:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (85 votes). Check out past polls.

    Notices?