Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #575 from cygx/createonly-x
use no longer new (but still shiny) open mode :x for spurt(:createonly)
  • Loading branch information
jnthn committed Nov 12, 2015
2 parents 92f9039 + a8560f5 commit f522533
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/core/IO/Path.pm
Expand Up @@ -484,10 +484,7 @@ my class IO::Path is Cool {
}

method !spurt($contents, :$enc, :$append, :$createonly, :$bin, |c) {
if $createonly and $.e {
fail("File '$!path' already exists, and :createonly was specified");
}
my $mode = $append ?? :a !! :w;
my $mode = $createonly ?? :x !! $append ?? :a !! :w;
my $handle = self.open(:enc($enc // 'utf8'), :$bin, |$mode, |c);
$handle // $handle.throw;

Expand Down

0 comments on commit f522533

Please sign in to comment.