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' }


In reply to Re: mod_perl and forwarding legacy functions to a global object by Juerd
in thread mod_perl and forwarding legacy functions to a global object by elusion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":