Ahh, I see. Great tip. Thanks alot. Jordan
On 10/27/06, John ORourke <[EMAIL PROTECTED]> wrote:
Jordan McLain wrote: > just noticed... in the actual code 'handler' is prototyped with ($$) > > >> sub handler { >> my ($class, $r) = @_; >> >> my $self = ... # something hashref-ish > >> I will end up writing another "new()" for use when not called directly >> from apache. Is this bad style, since the method does not return the >> blessed ref to something, but instead calls methods directly with the >> blessed ref? > Personally I get Apache to call new() for me, so other code can use the class in the same way apache does: ----------------------------------------------- in httpd.conf: PerlModule My::HandlerModule PerlResponseHandler My::HandlerModule->handler_method # apache calls your new() method automatically I think PerlFixupHandler My::HandlerModule->fixup_handler_method ----------------------------------------------- Or even better, when I want a single instance of my handler module per apache process: ----------------------------------------------- package My::HandlerModule; $My::HandlerModule::Persistent=My::HandlerModule->new(); sub new { etc etc } sub handler_method { my ($self,$r)[EMAIL PROTECTED]; etc etc } ----------------------------------------------- in httpd.conf: PerlResponseHandler $My::HandlerModule::Persistent->handler_method ----------------------------------------------- hope this helps, John