in reply to How many ways are there to use AUTOLOAD?

I discovered that one of my scripts was quietly dying because I'd used the right method on the wrong object.

What are you doing to make this possible? It sounds simply broken to me, but noone else in the thread appears to think so so I must just be out of context.

My first thought was that this was likely a problem with some misuse of inheritance, but you say "I'm not using inheritance", so I'm at a loss to imagine how you could end up with such a broken situation.

- tye        

  • Comment on Re: How many ways are there to use AUTOLOAD? (huh?)

Replies are listed 'Best First'.
Re^2: How many ways are there to use AUTOLOAD? (huh?)
by talexb (Chancellor) on Sep 03, 2004 at 16:35 UTC

    This morning's problem was that I was calling $document->gDbh when I should have been calling $document->_gDbh. As a result I was getting the error that method "do" was being called on an undefined object, that is, the undefined value coming back from my bad method call.

    For situations where I just called a method but didn't use the return value, I wanted to be sure to catch the typo.

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

      So how does $document->gDbh not produce the fatal error:

      Can't locate object method "gDbh" via package "...

      ? That is what I don't understand and what seems simply broken to me. That is the error I get when I call the wrong method and I don't have to play strange games with AUTOLOAD.

      - tye