in reply to Re^4: Improving your skills by reading module sources
in thread Improving your skills by reading module sources

IO::Handle actually abstracts little (it just gives some different syntax),

It is a base class, it doesn't need to do more. And if it doesn't need to, it shouldn't.

If only more (usually self-described) OO-experts would learn that lesson.

For reference, compare IO::Handle with IO::Moose::Handle.

Contrast them for:

The former knocks the spots of the latter in every single category.

and isn't the easiest to subclass.

And yet, a whole hierarchy of modules -- IO::Seekable, IO::File, IO::Socket, IO::Socket::INET et al. -- are sub-classed on top of it.

A file handle is a glob. It therefore has an associated hash and an associated array and even an associated scalar (which could hold a reference to a hash or an array). So, sub-classing is a doddle. It's just a matter of knowing the syntax.

And if you don't like any of those mechanisms, then you could always use the Tie::Handle method as used by IO::Socket::DNS.

It doesn't really impress me.

Maybe simplicity and pragmatism isn't your thing?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^5: Improving your skills by reading module sources