Skip to content
Browse files

Add IO::ArgFiles.slurp; change sub slurp to use it.

  • Loading branch information...
1 parent 75eebad commit 8e503621d4fa71e04b88bcfda15055c812f87ac7 @colomon colomon committed
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/CORE.setting
View
18 lib/CORE.setting
@@ -3612,11 +3612,7 @@ sub slurp($path?) is unsafe {
if $path {
Q:CgOp { (box Str (slurp (unbox str (@ {$path})))) }
} else {
- if @*ARGS {
- @*ARGS.map({ slurp($_) }).join;
- } else {
- $*IN.slurp;
- }
+ $*ARGFILES.slurp;
}
}
@@ -3737,10 +3733,6 @@ class IO::ArgFiles {
has $!args;
has $!reader;
- method lines() {
- gather take my $l while ($l = self.get).defined;
- }
-
method get() {
unless defined $!args {
$!args = [ @*ARGS ];
@@ -3755,6 +3747,14 @@ class IO::ArgFiles {
goto again;
}
}
+
+ method lines() {
+ gather take my $l while ($l = self.get).defined;
+ }
+
+ method slurp() {
+ self.lines.join("\n");
+ }
}
sub unlink(*@filenames) is unsafe {

0 comments on commit 8e50362

Please sign in to comment.
Something went wrong with that request. Please try again.