Created
March 17, 2011 12:31
-
-
Save SpringMT/874248 to your computer and use it in GitHub Desktop.
Capture::Tiny sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| fork+exec { $cmd } @args; | |
| use strict; | |
| use Capture::Tiny qw(capture); | |
| my ($stdout, $stderr) = capture { | |
| open my $fh, "| cat"; | |
| print $fh "foo bar baz\n"; | |
| }; | |
| warn $stdout; | |
| warn $stderr; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment