Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add "unlink" from master with small tweak
  • Loading branch information
coke committed Jul 5, 2011
1 parent 393264f commit b195df3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Perl6/Actions.pm
Expand Up @@ -157,7 +157,7 @@ class Perl6::Actions is HLL::Actions {
$outer.hll('perl6');
$unit.loadlibs('nqp_group', 'nqp_ops', 'perl6_group', 'perl6_ops',
'bit_ops', 'math_ops', 'trans_ops', 'io_ops',
'obscure_ops');
'obscure_ops', 'os');

# If the unit defines &MAIN, add a &MAIN_HELPER.
my $mainparam := PAST::Var.new(:name('$MAIN'), :scope('parameter'),
Expand Down
7 changes: 7 additions & 0 deletions src/core/IO.pm
Expand Up @@ -82,6 +82,13 @@ class IO {
}
}

sub unlink($filename) {
try {
pir::new__PS('OS').rm($filename);
}
$! ?? fail($!) !! 1.Bool
}

proto sub open(|$) { * }
multi sub open($filename, :$r, :$w, :$a, :$bin, :$chomp = 1.Bool) {
IO.new.open($filename, :$r, :$w, :$a, :$bin, :$chomp);
Expand Down

0 comments on commit b195df3

Please sign in to comment.