Re: Re: Symbol table globbing from object refs
by nothingmuch (Priest) on Nov 29, 2003 at 11:21 UTC
|
| [reply] |
|
|
->can() doesn't handle AUTOLOADed methods, FYI.
| [reply] |
|
|
| [reply] |
|
|
|
|
|
|
| [reply] |
|
|
|
|
|
|
|
|
|
|
|
Well, if it we're a means of getting responses for methods you don't know of it would be nice - most people that go around breaking it simply implement their own (see Class::Classless - i just submitted a patch (phew, a whole one line) for it to return code refs instead of 1, and Class::Object - i trust the documentation).
The problem is that @ISA is not used, or perl's builtin method calling system is extended. That's the showstopper.
Provided Autoload would provide (and export) a can, which either returns an anonymous subroutine that takes care of things, or actually loads the sub and returns a subroutine ref to that, It should pose no problem at all.
| [reply] |
|
|
|
|
Re: Re: Symbol table globbing from object refs
by nothingmuch (Priest) on Nov 29, 2003 at 11:11 UTC
|
But @ISA is usually lexical, which means i have to peek into it somehow. Ugly.
@ISA is also very flexible - code refs and such. I'm not sure I want to implement something that's already been done - emulation is never 100%
Morever, I can't guarantee this has a module, i'm expecting weird objects (classless ones, and so forth), so Module::Info doesn't work. At least not unless I use it on an opened scalar ref, containing B::Deparse's output. Very ugly.
Last but not least, this is too resource intensive for such a simple job, IMHO.
| [reply] |
|
|
But @ISA is usually lexical, which means i have to peek into it somehow.
Say what?!? If @ISA isn't a global/package variable, inheritance won't work. So it's never a lexical.
| [reply] |
|
|
So what?
You requirements/expectations are completely unrealistic.
| [reply] |
|
|
I think they are pretty reasonable...
PodMaster was absolutely right about Devel::Symdump, and I was totally wrong about walking @ISA. For some reason I thought it was lexical by default.
I managed to find a solution that doesn't parse it's own code, and works under 20 lines of code, so i think it's realistic... =)
Update: well... no classless objects, but...
| [reply] |