At 21:30 02.10.2002, william ross wrote:

>On Wednesday, October 2, 2002, at 08:18 PM, Per Einar Ellefsen wrote:
>
>>At 20:47 02.10.2002, william ross wrote:
>>>but I can't find anything to tell me how to do it. I feel sure I'm 
>>>missing something really obvious here?
>>
>>You can configure objects instead of using static class names. See the doc:
>>
>>http://perl.apache.org/docs/1.0/guide/method_handlers.html
>
>sorry: i wasn't very clear, was I? I am using a method handler, but I want 
>to pass an object of another class to it each time it is called. The 
>object needs to be created outside of an individual request, and therefore 
>presumably in a startup file, and then either passed to the handler along 
>with each request, or somehow made available to all the requests, but 
>preferably without setting a class variable, which is what I do at the 
>moment but dislike.

Yes, and that it exactly what the doc I referred to shows you:
You instantiate an object in your startup file; then you configure mod_perl 
to call your handler with this object as the class, like:
PerlHandler $My::obj->handler
$My::Obj must then be an instance of the handler class, but can contain any 
other information too.
Now, in your handler, you get:
sub handler ($$) {
my ($obj, $r) = @_;

and you have your $obj, which you can use freely. ($obj isn't a class name, 
it is an ... object!)

Wasn't that what you wanted?


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]


Reply via email to