in reply to Re^2: "polymorphism" hack: nuts or wise?
in thread "polymorphism" hack: nuts or wise?

In this case, inheritance would just be used to mark classes as implementing a certain interface. There is no "implements" equivalent in Perl, so you can fake it by making an empty class with a descriptive name and POD that describes an interface, and then adding it to the @ISA for classes which implement that interface. Then you have a simple way to check, via isa().
  • Comment on Re^3: "polymorphism" hack: nuts or wise?

Replies are listed 'Best First'.
Re^4: "polymorphism" hack: nuts or wise?
by chromatic (Archbishop) on Aug 26, 2005 at 19:39 UTC
Re^4: "polymorphism" hack: nuts or wise?
by Ovid (Cardinal) on Aug 26, 2005 at 19:00 UTC

    Ah, now I get it. I was thinking that inheritance is bad because what one really cares about is interface, not type. Faking "implements" makes that problem go away. (Another tool for my box. Thanks!)

    Cheers,
    Ovid

    New address of my CGI Course.