Skip to content

Commit

Permalink
Absolute minimum changes needed to support opening pipes for reading …
Browse files Browse the repository at this point in the history
…and writing
  • Loading branch information
Geoffrey Broadwell committed Jul 31, 2012
1 parent 7c4c8b1 commit 271741a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/IO.pm
Expand Up @@ -88,10 +88,11 @@ class IO does IO::FileTestable {
has $.path;

proto method open(|$) { * }
multi method open($path? is copy, :$r, :$w, :$a, :$bin, :$chomp = Bool::True,
multi method open($path? is copy, :$r, :$w, :$a, :$p, :$bin, :$chomp = Bool::True,
:enc(:$encoding) = 'utf8') {
$path //= $.path;
my $mode = $w ?? 'w' !! ($a ?? 'wa' !! 'r');
my $mode = $p ?? ($w || $a ?? 'wp' !! 'rp') !!
($w ?? 'w' !! ($a ?? 'wa' !! 'r' ));
# TODO: catch error, and fail()
nqp::bindattr(self, IO, '$!PIO',
$path eq '-'
Expand Down Expand Up @@ -329,8 +330,8 @@ sub rmdir($path) {
}

proto sub open(|$) { * }
multi sub open($path, :$r, :$w, :$a, :$bin, :$chomp = Bool::True, :enc(:$encoding) = 'utf8') {
IO.new.open($path, :$r, :$w, :$a, :$bin, :$chomp, :$encoding);
multi sub open($path, :$r, :$w, :$a, :$p, :$bin, :$chomp = Bool::True, :enc(:$encoding) = 'utf8') {
IO.new.open($path, :$r, :$w, :$a, :$p, :$bin, :$chomp, :$encoding);
}

proto sub lines(|$) { * }
Expand Down

0 comments on commit 271741a

Please sign in to comment.