[ Please keep it on the list ]
On 7/3/07, pubert na <[EMAIL PROTECTED]> wrote:
The app I'm working with uses this as a method for object b to retrieve the
instance of object a, which created it.
i.e. An object x, creates 4 objects, a,b,c, and d, then calls a method in
object a. Object a needs a reference to object b so it calls
$foo=CLASSX::getInstance() which returns $self. Object a can then call
$foo->getObjectB and it has what it wants.
I don't really understand this description. If you're trying to code
a singleton pattern, use global variables to hold the object. That
makes it clearer what your intent is.
Apparently this does not work at all under mod_perl. The only fix I can
think of is passing the instantiating object as a parameter when the object
is created. What do you guys usually do?
Scoping works the same as usual under mod_perl. If you need access to
object instances, you can use a singleton pattern, storing the objects
in global variables, or you can pass the instances to the sub that
needs to use them.
- Perrin