Here's a basic proposal for the open and pipe builtins. It was discussed
on #perl6 today and seemed okay to the people there. I'd like to hear
your comments, since the internals side of much of this is ready and is
looking for an interface.
has Handle $:read_h;
has Handle $:write_h;
has Handle $:err_h;
has Process $:process_h;
multi sub open (
Str ?$filename = $?CALLER::_,
Str ?$mode = '<',
Str ?$encoding = 'auto') returns IO;
multi sub pipe (
Str ?$command = $?CALLER::_,
Str ?$encoding = 'auto',
+?to, +?from, +?skip_shell) returns IO;
Notes / questions:
Perl5-style open ">file" is no more. An earlier discussion about
open here brought up URI open, but I think there was no final word,
and it looks to me that the basic open should always mean file open,
unless explicity modified. E.g., open could be used as a facade for pipe,
open 'ls', '|-'; # or even
open 'ls', :pipe => 'from'
This pipe as it is can automatically do open2/3 if both :from and :to
are given. I don't know if this is a good thing.
Is it sane to have handle members when half of the time most of them
are undef? (E.g. in ro open)
One suggestion for the 'auto' encoding was to honor a BOM if it is
present but default to ASCII otherwise. Or should we UTF-8 otherwise?
Or what's in the environment...?
And what about IO layers? :)
What else belongs here? dirhandles, sockets? How are they specced? I
was looking for a happy medium between overdwim and underlying library
 Should this be "Perl(..5) style"?
Gaal Yahas <[EMAIL PROTECTED]>