Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

$*IN capturing.

  • Loading branch information...
commit 667269fccd6de5145c001ce2ffc1edf501b1a95e 1 parent b65adaa
Filip Sergot authored April 20, 2012

Showing 1 changed file with 17 additions and 3 deletions. Show diff stats Hide diff stats

  1. 20  lib/IO/Capture/Simple.pm
20  lib/IO/Capture/Simple.pm
@@ -65,11 +65,25 @@ sub capture_stderr_on($target is rw) is export {
65 65
 }
66 66
 
67 67
 sub capture_stdin(Callable $code) is export {
68  
-	...
  68
+	my $result;
  69
+
  70
+	my $*IN = class {
  71
+		method get() {
  72
+			$result ~= $stdin.get;
  73
+		}
  74
+	}
  75
+
  76
+	$code.();
  77
+
  78
+	$result;
69 79
 }
70 80
 
71  
-sub capture_stdin_on($target) is export {
72  
-	...
  81
+sub capture_stdin_on($target is rw) is export {
  82
+	$*IN = class {
  83
+		method get() {
  84
+			$target ~= $stdin.get;
  85
+		}
  86
+	}
73 87
 }
74 88
 
75 89
 sub capture_stdout_off is export {

0 notes on commit 667269f

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