in reply to Re: Real life OO examples
in thread Real life OO examples

Actually, File::Spec is one of the worst examples in the Perl distro, because it's all about class methods, and no instances, and alters global behavior with global switches instead of carrying differing states around in instance variables.

For distro-only examples, see the IO::File hierarchy. A little messy, but the inheritance, class, instance, and constructor methods are all pretty interesting and a good use of inheritance (and even dare I say "multiple inheritance").

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re: •Re: Re: Real life OO examples
by demerphq (Chancellor) on Oct 18, 2002 at 17:17 UTC
    Oooh. (No pun intended.) Thanks for the clarification. I have to admit that I was thinking mostly on the exposed interface level and didn't consider the innerds at all. Which on reflection upon the OP was reasonably dumb. :-)

    But as a partial justification I was thinking of the way that you have one module with a clearly defined interface, that then automatically uses the appropriate overrides to provide a per OS functionality. While the class based interface is a touch annoying (ive taken to doing

    use constant FS=>'File::Spec'; my ($v,$p,$f)=FS->splitpath($0);
    as a shortcut) the versatility is not.

    Thanks for the pointer though, while not feeling that I need that much extra OO exposure (I do almost pure OO perl, and I've read your and TOMC's and TheDamians books and writings on the subjects already) I will certainly take the time to review these modules to see if theres anything more for me to learn (probably ;-).

    Incidentally, I wonder if pointing out Tie::SecureHash to the OP is worthwhile or not?

    --- demerphq
    Nice disclaimer :-)