Garrett Goebel <[EMAIL PROTECTED]> writes:
>What's the conventional wisdom on creating a module that supports both an OO
>and non-OO interface? Are there any CORE or CPAN modules to serve as a
>textbook, or is the anwser "Don't do that"?
Tk does it - which can be taken either way ;-)
>
>I've got some code that checks the first parameter passed to see if it is a
>reference, assumes any reference is an object reference... and then proceeds
>accordingly. -It feels pretty sloppy, but it works.
It is either fragile or slow depending how picky your validator gets.
I tend to find it makes sense to not use the _same_ sub in both interfaces.
Rather have
sub Foo # (say) the method
and
sub foo # the functional interface
Then implement one in terms of the other.
>
>Garrett
--
Nick Ing-Simmons