Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some corrections.

  • Loading branch information...
commit 263fbf76574451ac5d21f07f19515cc74ac6d5e3 1 parent 9d93929
@sergot authored
Showing with 15 additions and 6 deletions.
  1. +15 −6 lib/IO/Capture/Simple.pm
View
21 lib/IO/Capture/Simple.pm
@@ -2,12 +2,13 @@ module IO::Capture::Simple;
my $stdout = $*OUT;
my $stderr = $*ERR;
+my $stdin = $*IN;
-multi sub capture(Block $code) is export {
+multi sub capture(Callable $code) is export {
...
}
-multi sub capture_stdout(Block $code) is export {
+multi sub capture_stdout(Callable $code) is export {
my $result;
my $*OUT = class {
@@ -21,7 +22,7 @@ multi sub capture_stdout(Block $code) is export {
$result;
}
-multi sub capture_stdout($target is rw) {
+multi sub capture_stdout_on($target is rw) is export {
$*OUT = class {
method print(*@args) {
$target ~= @args.join;
@@ -29,7 +30,7 @@ multi sub capture_stdout($target is rw) {
}
}
-multi sub capture_stderr(Block $code) is export {
+multi sub capture_stderr(Callable $code) is export {
my $result;
my $*ERR = class {
@@ -43,7 +44,7 @@ multi sub capture_stderr(Block $code) is export {
$result;
}
-multi sub capture_stderr($target is rw) is export {
+multi sub capture_stderr_on($target is rw) is export {
$*ERR = class {
method print(*@args) {
$target ~= @args.join;
@@ -51,7 +52,11 @@ multi sub capture_stderr($target is rw) is export {
}
}
-multi sub capture_stdin(Block $code) is export {
+multi sub capture_stdin(Callable $code) is export {
+ ...
+}
+
+multi sub capture_stdin($target) is export {
...
}
@@ -62,3 +67,7 @@ sub capture_stdout_off is export {
sub capture_stderr_off is export {
$*ERR = $stderr;
}
+
+sub capture_stdin_off is export {
+ $*IN = $stdin;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.