NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Nigglies (Score:1)
Now how do we tell that it's an iterator coderef? How do we know that this coderef that the user invented to satisfy your API actually works?
Because that's yet another type of bug, one that's probably even harder to find again.
Oh, and as for your tell and seek, there's a role for that already, called IO::Seekable. IO::Handle on it's own DOESN'T assume that the filehandle is seekable, it may well be a stream.
So something like IO::File responds to both ->isa('IO::Handle') and ->isa('IO::Seekable').
Experimentally over the last 3 months I've started using _INSTANCE($param, 'IO::Seekable') in a few places to see if people notice. So far nobody seems to have complained.
I wonder if a _SEEKABLE would be more useful than the nightmare of trying to do _FILEHANDLE....
Reply to This
Re:Nigglies (Score:1)
That's a big improvement from "if our undisclosed criterion for being a filehandle passes, we will diamond your value." Even if they disclose their method (which would be unusual) it means you have to know what it is. Callability is a solved problem, as I see it.
rjbs