Skip to content

Commit

Permalink
Implement basic open support in the core setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Feb 6, 2010
1 parent 2849ae6 commit 137e8f8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/IO.pm
Expand Up @@ -82,4 +82,14 @@ multi sub prompt($msg) {

multi sub say(Mu *@items) { $*OUT.say(@items); }

sub open($filename, :$r, :$w, :$a) {
my $mode = $w ?? 'w' !! ($a ?? 'wa' !! 'r');
my $PIO = pir::open__PSS($filename, $mode);
unless pir::istrue__IP($PIO) {
die("Unable to open file '$filename'");
}
$PIO.encoding('utf8');
IO.new(:$PIO)
}

# vim: ft=perl6

0 comments on commit 137e8f8

Please sign in to comment.