Dear Log,
Thought for the day: if you provide an AUTOLOAD
for a class, you should also provide a can
, so that you will avoid the situation of $object->can('hoozits')
returning false where 'hoozits' is an autoloaded method.
Re:Indeed
TorgoX on 2002-02-24T23:13:42
Excellent! Just what I was thinking!Either that, or put the actual make-the-routine stuff in can(), and have AUTOLOAD just call the can() to make return the routine (if can), and then just put that into the symbol table and move on. Too bad this isn't in any of examples of AUTOLOAD use that I've seen.
Re:Indeed
pudge on 2002-02-24T23:26:38
That's a good thought; perhaps if I had thought of can() when I first did AUTOLOAD(), I might have done it that way. It'd be just as easy, and probably even cleaner. But can() is usually an afterthought at best. Maybe someday when I feel like just playing with it, I'll rewrite it to do that.