Capture-Tiny

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    via named files instead of anonymous ones [inspired by Christian Walde]

  Fixed:

  - Tied filehandles based on Tie::StdHandle can now use the ":utf8"
    layer; removed remaining TODO tests; adds Scalar::Util as a dependency

  Changed:

  - When Time::HiRes::usleep is available, tee operations will
    sleep during the busy-loop waiting for tee processes to be ready
    [rt.cpan.org #67858]

0.11      2011-05-19 23:34:23 America/New_York

  Fixed:

  - Tests will not use Test::Differences version 0.60 or greater

0.10      2011-02-07 07:01:44 EST5EDT

t/18-custom-capture.t  view on Meta::CPAN

$temp_out = tmpnam();
$temp_err = tmpnam();

ok( !-e $temp_out, "Temp out '$temp_out' doesn't exist" );
ok( !-e $temp_err, "Temp out '$temp_err' doesn't exist" );

$out_fh = IO::File->new($temp_out, "a+");
$err_fh = IO::File->new($temp_err, "a+");

($got_out, $got_err) = capture {
  my $i = 0; $i++ for 1 .. 10; # no output, just busywork
} stdout => $out_fh, stderr => $err_fh;

is( $got_out, "",
  "Try 1: captured empty appended STDOUT to custom handle"
);
is( $got_err, "",
  "Try 1: captured empty appended STDERR to custom handle"
);

($got_out, $got_err) = capture {
  my $i = 0; $i++ for 1 .. 10; # no output, just busywork
} stdout => $out_fh, stderr => $err_fh;

is( $got_out, "",
  "Try 2: captured empty appended STDOUT to custom handle"
);
is( $got_err, "",
  "Try 2: captured empty appended STDERR to custom handle"
);

unlink $_ for $temp_out, $temp_err;



( run in 0.496 second using v1.01-cache-2.11-cpan-87723dcf8b7 )