[REPOST] MyClass::import() not being called.

2000-10-23 Thread Rodney Broom

Hi all,

Did we forget me? (snif, snif...)


I've got this happy little access handler that works just fine. I'm loading it
like this:
  PerlAccessHandler MyClass

Now I need for it to accept parameters through import(). That would let me
change the usage to something like this:
  PerlAccessHandler MyClass 'extra parameters'

The catch is that MyClass::import() isn't being called reguardless of how I load
it. I've done all of the obvious stuff, like including lots of debugging
messages in the package, reading the docs, reading the Apache modules book, and
even searching the archives for this list, no help. Does anybody know what's
happening here?


Rodney Broom






Re: [REPOST] MyClass::import() not being called.

2000-10-23 Thread Rodney Broom

From: "Carlos Ramirez" [EMAIL PROTECTED]
CR You can use PerlSetVar to set parameters like so:

CR PerlAccessHandler MyClass
CR PerlSetVar Param1
CR PerlSetVar Param2


Yep, that's definately an effective work-around. My biggest concern is the fact
that import() doesn't seem to be getting called at all. That sounds broken to
me.


Rodney Broom






Re: [REPOST] MyClass::import() not being called.

2000-10-23 Thread Benjamin Trott

 The types of parameters I'll pass to this handler will change
 machine-by-machine. You see, I need to run this package on several different
 servers, and need it to know how to configure it's self.

Okay... I don't think I get exactly why this situation makes using
PerlSetVar impossible/impractical, because if you were thinking that you
could write

PerlAccessHandler My::Access 'parameters'

Why can't you just write

PerlAccessHandler My::Access
PerlSetVar param1 value1
PerlSetVar param2 value2

So I'm not sure I understand that distinction.

*However*, if you really want to use import, couldn't you go about doing so
like this:

Perl
use My::Access 'parameters';
/Perl

PerlAccessHandler My::Access

If you do that, and define a My::Access::import, it should definitely be
called correctly.

bye,
Ben




Re: [REPOST] MyClass::import() not being called.

2000-10-23 Thread Ken Williams

[EMAIL PROTECTED] (Rodney Broom) wrote:
I've got this happy little access handler that works just fine. I'm
loading it like this:
 PerlAccessHandler MyClass

Now I need for it to accept parameters through import(). That would let
me change the usage to something like this:
 PerlAccessHandler MyClass 'extra parameters'

The catch is that MyClass::import() isn't being called reguardless of
how I load it. 

I actually wouldn't expect it to call import() with the given parameter
list, simply because it's documented to do something else.  It's
documented to think of the second parameter as another AccessHandler
module, as in chained handlers.

Remember: PerlModule is the way to load new modules.  Ordinarily you
should do "PerlModule Blah" to load the module, and then "Perl*Handler
Blah" to actually install it as a handler somewhere.  However, in recent
versions of mod_perl, the "PerlModule Blah" will be done automatically
for you if you refer to a previously unseen module as a handler.

To me, the exact behavior you're looking for seems like a bad idea,
because as Benjamin pointed out, it conflicts with the chained handler
syntax.  But it seems reasonable that PerlModule might take an import()
list.  I'm not sure whether it does so now or not.


  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum