Permalink
Browse files

Some corrections.

  • Loading branch information...
1 parent 9d93929 commit 263fbf76574451ac5d21f07f19515cc74ac6d5e3 @sergot committed Apr 17, 2012
Showing with 15 additions and 6 deletions.
  1. +15 −6 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,15 +22,15 @@ 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;
}
}
}
-multi sub capture_stderr(Block $code) is export {
+multi sub capture_stderr(Callable $code) is export {
my $result;
my $*ERR = class {
@@ -43,15 +44,19 @@ 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;
}
}
}
-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;
+}

0 comments on commit 263fbf7

Please sign in to comment.