in reply to Re: Symbol table globbing from object refs
in thread Symbol table globbing from object refs

I don't know how I ever missed Devel::Symdump! I searched before asking, but alas...

I think it will do the trick with some @ISA snooping...!

Thanks!



-nuffin
zz zZ Z Z #!perl
  • Comment on Re: Re: Symbol table globbing from object refs

Replies are listed 'Best First'.
Re: Re: Re: Symbol table globbing from object refs
by diotalevi (Canon) on Nov 29, 2003 at 18:18 UTC
    ->can() doesn't handle AUTOLOADed methods, FYI.
        What is that, a joke? `cd src/perl-5.8.2; grep -ril canautoload` doesn't show any such thing.

      It does if you tell it to, which you should.

        Why should you tell it to?

        When I write an AUTOLOAD method, I'll typically dynamically decide at runtime whether or not I really want to handle it. Anyone who assumes that I'll handle their method because I have an AUTOLOAD is more often wrong than right.

        Unless we coordinate on how to declare methods, there is no good answer to that.

        Furthermore I am uncomfortable with encouraging people to roll their own can because when I use it, I darned well expect it to work right and they might get it wrong. Do they handle multiple inheritance properly? Do they return a subroutine that can be called directly? (Returning the AUTOLOAD won't work.) Do they return the same subroutine multiple times for the same class?

        Yes, I have written code which would break if you change any of the above properties.

        Anyone who cannot be trusted to think of all of this shouldn't be overwriting globally defined methods which could be called by other people who expect that things work properly.

        Did that change since 5.8.0?
      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.


      -nuffin
      zz zZ Z Z #!perl
        I hope that your one-line patch to Class::Classless addressed the documented reason for originally not returning code refs, and fixed the documentation as well.