-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I'm not sure if I've run into a limitation of perl or if I'm just doing something boneheaded, but I expected this to work (this is an effort to avoid the use of a tempdir on a read-only filesystem):
use strict;
use warnings;
use Capture::Tiny 'capture';
my $out = '';
my $err = '';
open my $out_fh, '+>', \$out or die "cannot open to scalarref: $!";
open my $err_fh, '+>', \$err or die "cannot open to scalarref: $!";
capture {
print STDOUT "foo\n";
print STDERR "bar\n";
} stdout => $out_fh, stderr => $err_fh;
However, I get:
Error from open(GLOB(0x7fca5e810ed0), >&-1): Invalid argument at /Users/ether/.perlbrew/libs/26.3@std/lib/perl5/Capture/Tiny.pm line 107.
Capture::Tiny::_open(GLOB(0x7fca5e810ed0), ">\x{26}-1") called at /Users/ether/.perlbrew/libs/26.3@std/lib/perl5/Capture/Tiny.pm line 194
Capture::Tiny::_open_std(HASH(0x7fca5e810cc0)) called at /Users/ether/.perlbrew/libs/26.3@std/lib/perl5/Capture/Tiny.pm line 370
Capture::Tiny::_capture_tee(undef, undef, undef, undef, 1, 1, 0, 0, ...) called at stderr.pl line 12
Metadata
Metadata
Assignees
Labels
No labels