Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[IO] spurt :new is now :createonly
  • Loading branch information
moritz committed Jul 14, 2012
1 parent 55cf00a commit ee86a54
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/core/IO.pm
Expand Up @@ -381,21 +381,21 @@ proto sub spurt(|$) { * }
multi sub spurt(Cool $filename,
Cool $contents,
:encoding(:$enc) = 'utf8',
:$new,
:$createonly,
:$append) {
fail("File '$filename' already exists, but :new was give to spurt")
if $new && $filename.IO.e;
fail("File '$filename' already exists, but :createonly was give to spurt")
if $createonly && $filename.IO.e;
my $mode = $append ?? :a !! :w;
my $fh = open($filename.Str, :$enc, |$mode);
$fh.print($contents);
$fh.close;
}
multi sub spurt(Cool $filename,
Buf $contents,
:$new,
:$createonly,
:$append) {
fail("File '$filename' already exists, but :new was give to spurt")
if $new && $filename.IO.e;
fail("File '$filename' already exists, but :createonly was give to spurt")
if $createonly && $filename.IO.e;
my $mode = $append ?? :a !! :w;
my $fh = open($filename.Str, :bin, |$mode);
$fh.write($contents);
Expand Down

0 comments on commit ee86a54

Please sign in to comment.