On Fri, Apr 22, 2005 at 11:28:06AM +0200, Juerd wrote: : Which brings me to the following: can open please use the same kind of : $file, so that open $filehandle just checks $filehandle's mode and : returns $filehandle again? That way, every library function that accepts : a filename automatically also accepts an open filehandle, which has a : thousand and one benefits. You speak of "open" as if it must be a single function. We're now living in the age of MMD, so what you're asking for is a no-brainer. If we decided to we could even do MMD with constraints: multi sub open ($u of Str where /^file:/, *@opts) returns Handle {...} multi sub open ($u of Str where /^http:/, *@opts) returns Handle {...} multi sub open ($u of Str where /^ftp:/, *@opts) returns Handle {...} multi sub open ($u of Str where /^mailto:/, *@opts) returns Handle {...} ... Though that would potentially be problematic if you wanted to open a file whose name started with "http:", so we'd probably want to give that suite of multis a different name. Call it io() maybe, if we can unify the Handle and IO abstractions. As I've said before, I kinda like the IO::All module, except for how it overloads < and >. But Perl 6 has ==> and <== that can do that instead, which just happen to be called "pipes", strange coincidence. :-) Presumably you can write a "slurp" like this: my $page <== io("http://www.wall.org/~larry"); LarryThread Previous | Thread Next