From 6243689a348d169d15dc66f027d817b420742703 Mon Sep 17 00:00:00 2001 From: "shogo82148-slim[bot]" <90079370+shogo82148-slim[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 06:35:06 +0000 Subject: [PATCH] update cpanm --- author/cpanm/cpanfile.snapshot | 404 ++++++++++++++++----------------- bin/cpanm | 2 +- 2 files changed, 203 insertions(+), 203 deletions(-) diff --git a/author/cpanm/cpanfile.snapshot b/author/cpanm/cpanfile.snapshot index fbada8a46..bc7989e26 100644 --- a/author/cpanm/cpanfile.snapshot +++ b/author/cpanm/cpanfile.snapshot @@ -138,10 +138,10 @@ DISTRIBUTIONS perl 5.008001 strict 0 warnings 0 - Capture-Tiny-0.48 - pathname: D/DA/DAGOLDEN/Capture-Tiny-0.48.tar.gz + Capture-Tiny-0.50 + pathname: D/DA/DAGOLDEN/Capture-Tiny-0.50.tar.gz provides: - Capture::Tiny 0.48 + Capture::Tiny 0.50 requirements: Carp 0 Exporter 0 @@ -1041,205 +1041,205 @@ DISTRIBUTIONS Test::Harness 3.50 requirements: ExtUtils::MakeMaker 0 - Test-Simple-1.302204 - pathname: E/EX/EXODIST/Test-Simple-1.302204.tar.gz - provides: - Test2 1.302204 - Test2::API 1.302204 - Test2::API::Breakage 1.302204 - Test2::API::Context 1.302204 - Test2::API::Instance 1.302204 - Test2::API::InterceptResult 1.302204 - Test2::API::InterceptResult::Event 1.302204 - Test2::API::InterceptResult::Facet 1.302204 - Test2::API::InterceptResult::Hub 1.302204 - Test2::API::InterceptResult::Squasher 1.302204 - Test2::API::Stack 1.302204 - Test2::AsyncSubtest 1.302204 - Test2::AsyncSubtest::Event::Attach 1.302204 - Test2::AsyncSubtest::Event::Detach 1.302204 - Test2::AsyncSubtest::Formatter 1.302204 - Test2::AsyncSubtest::Hub 1.302204 - Test2::Bundle 1.302204 - Test2::Bundle::Extended 1.302204 - Test2::Bundle::More 1.302204 - Test2::Bundle::Simple 1.302204 - Test2::Compare 1.302204 - Test2::Compare::Array 1.302204 - Test2::Compare::Bag 1.302204 - Test2::Compare::Base 1.302204 - Test2::Compare::Bool 1.302204 - Test2::Compare::Custom 1.302204 - Test2::Compare::DeepRef 1.302204 - Test2::Compare::Delta 1.302204 - Test2::Compare::Event 1.302204 - Test2::Compare::EventMeta 1.302204 - Test2::Compare::Float 1.302204 - Test2::Compare::Hash 1.302204 - Test2::Compare::Isa 1.302204 - Test2::Compare::Meta 1.302204 - Test2::Compare::Negatable 1.302204 - Test2::Compare::Number 1.302204 - Test2::Compare::Object 1.302204 - Test2::Compare::OrderedSubset 1.302204 - Test2::Compare::Pattern 1.302204 - Test2::Compare::Ref 1.302204 - Test2::Compare::Regex 1.302204 - Test2::Compare::Scalar 1.302204 - Test2::Compare::Set 1.302204 - Test2::Compare::String 1.302204 - Test2::Compare::Undef 1.302204 - Test2::Compare::Wildcard 1.302204 - Test2::Event 1.302204 - Test2::Event::Bail 1.302204 - Test2::Event::Diag 1.302204 - Test2::Event::Encoding 1.302204 - Test2::Event::Exception 1.302204 - Test2::Event::Fail 1.302204 - Test2::Event::Generic 1.302204 - Test2::Event::Note 1.302204 - Test2::Event::Ok 1.302204 - Test2::Event::Pass 1.302204 - Test2::Event::Plan 1.302204 - Test2::Event::Skip 1.302204 - Test2::Event::Subtest 1.302204 - Test2::Event::TAP::Version 1.302204 - Test2::Event::V2 1.302204 - Test2::Event::Waiting 1.302204 - Test2::EventFacet 1.302204 - Test2::EventFacet::About 1.302204 - Test2::EventFacet::Amnesty 1.302204 - Test2::EventFacet::Assert 1.302204 - Test2::EventFacet::Control 1.302204 - Test2::EventFacet::Error 1.302204 - Test2::EventFacet::Hub 1.302204 - Test2::EventFacet::Info 1.302204 - Test2::EventFacet::Info::Table 1.302204 - Test2::EventFacet::Meta 1.302204 - Test2::EventFacet::Parent 1.302204 - Test2::EventFacet::Plan 1.302204 - Test2::EventFacet::Render 1.302204 - Test2::EventFacet::Trace 1.302204 - Test2::Formatter 1.302204 - Test2::Formatter::TAP 1.302204 - Test2::Hub 1.302204 - Test2::Hub::Interceptor 1.302204 - Test2::Hub::Interceptor::Terminator 1.302204 - Test2::Hub::Subtest 1.302204 - Test2::IPC 1.302204 - Test2::IPC::Driver 1.302204 - Test2::IPC::Driver::Files 1.302204 - Test2::Manual 1.302204 - Test2::Manual::Anatomy 1.302204 - Test2::Manual::Anatomy::API 1.302204 - Test2::Manual::Anatomy::Context 1.302204 - Test2::Manual::Anatomy::EndToEnd 1.302204 - Test2::Manual::Anatomy::Event 1.302204 - Test2::Manual::Anatomy::Hubs 1.302204 - Test2::Manual::Anatomy::IPC 1.302204 - Test2::Manual::Anatomy::Utilities 1.302204 - Test2::Manual::Concurrency 1.302204 - Test2::Manual::Contributing 1.302204 - Test2::Manual::Testing 1.302204 - Test2::Manual::Testing::Introduction 1.302204 - Test2::Manual::Testing::Migrating 1.302204 - Test2::Manual::Testing::Planning 1.302204 - Test2::Manual::Testing::Todo 1.302204 - Test2::Manual::Tooling 1.302204 - Test2::Manual::Tooling::FirstTool 1.302204 - Test2::Manual::Tooling::Formatter 1.302204 - Test2::Manual::Tooling::Nesting 1.302204 - Test2::Manual::Tooling::Plugin::TestExit 1.302204 - Test2::Manual::Tooling::Plugin::TestingDone 1.302204 - Test2::Manual::Tooling::Plugin::ToolCompletes 1.302204 - Test2::Manual::Tooling::Plugin::ToolStarts 1.302204 - Test2::Manual::Tooling::Subtest 1.302204 - Test2::Manual::Tooling::TestBuilder 1.302204 - Test2::Manual::Tooling::Testing 1.302204 - Test2::Mock 1.302204 - Test2::Plugin 1.302204 - Test2::Plugin::BailOnFail 1.302204 - Test2::Plugin::DieOnFail 1.302204 - Test2::Plugin::ExitSummary 1.302204 - Test2::Plugin::SRand 1.302204 - Test2::Plugin::Times 1.302204 - Test2::Plugin::UTF8 1.302204 - Test2::Require 1.302204 - Test2::Require::AuthorTesting 1.302204 - Test2::Require::AutomatedTesting 1.302204 - Test2::Require::EnvVar 1.302204 - Test2::Require::ExtendedTesting 1.302204 - Test2::Require::Fork 1.302204 - Test2::Require::Module 1.302204 - Test2::Require::NonInteractiveTesting 1.302204 - Test2::Require::Perl 1.302204 - Test2::Require::RealFork 1.302204 - Test2::Require::ReleaseTesting 1.302204 - Test2::Require::Threads 1.302204 - Test2::Suite 1.302204 - Test2::Todo 1.302204 - Test2::Tools 1.302204 - Test2::Tools::AsyncSubtest 1.302204 - Test2::Tools::Basic 1.302204 - Test2::Tools::Class 1.302204 - Test2::Tools::ClassicCompare 1.302204 - Test2::Tools::Compare 1.302204 - Test2::Tools::Defer 1.302204 - Test2::Tools::Encoding 1.302204 - Test2::Tools::Event 1.302204 - Test2::Tools::Exception 1.302204 - Test2::Tools::Exports 1.302204 - Test2::Tools::GenTemp 1.302204 - Test2::Tools::Grab 1.302204 - Test2::Tools::Mock 1.302204 - Test2::Tools::Ref 1.302204 - Test2::Tools::Refcount 1.302204 - Test2::Tools::Spec 1.302204 - Test2::Tools::Subtest 1.302204 - Test2::Tools::Target 1.302204 - Test2::Tools::Tester 1.302204 - Test2::Tools::Tiny 1.302204 - Test2::Tools::Warnings 1.302204 - Test2::Util 1.302204 - Test2::Util::ExternalMeta 1.302204 - Test2::Util::Facets2Legacy 1.302204 - Test2::Util::Grabber 1.302204 - Test2::Util::Guard 1.302204 - Test2::Util::HashBase 1.302204 - Test2::Util::Importer 1.302204 - Test2::Util::Ref 1.302204 - Test2::Util::Stash 1.302204 - Test2::Util::Sub 1.302204 - Test2::Util::Table 1.302204 - Test2::Util::Table::Cell 1.302204 - Test2::Util::Table::LineBreak 1.302204 - Test2::Util::Term 1.302204 - Test2::Util::Times 1.302204 - Test2::Util::Trace 1.302204 - Test2::V0 1.302204 - Test2::Workflow 1.302204 - Test2::Workflow::BlockBase 1.302204 - Test2::Workflow::Build 1.302204 - Test2::Workflow::Runner 1.302204 - Test2::Workflow::Task 1.302204 - Test2::Workflow::Task::Action 1.302204 - Test2::Workflow::Task::Group 1.302204 - Test::Builder 1.302204 - Test::Builder::Formatter 1.302204 - Test::Builder::IO::Scalar 2.114 - Test::Builder::Module 1.302204 - Test::Builder::Tester 1.302204 - Test::Builder::Tester::Color 1.302204 - Test::Builder::Tester::Tie 1.302204 - Test::Builder::TodoDiag 1.302204 - Test::More 1.302204 - Test::Simple 1.302204 - Test::Tester 1.302204 - Test::Tester::Capture 1.302204 - Test::Tester::CaptureRunner 1.302204 - Test::Tester::Delegate 1.302204 - Test::use::ok 1.302204 - ok 1.302204 + Test-Simple-1.302205 + pathname: E/EX/EXODIST/Test-Simple-1.302205.tar.gz + provides: + Test2 1.302205 + Test2::API 1.302205 + Test2::API::Breakage 1.302205 + Test2::API::Context 1.302205 + Test2::API::Instance 1.302205 + Test2::API::InterceptResult 1.302205 + Test2::API::InterceptResult::Event 1.302205 + Test2::API::InterceptResult::Facet 1.302205 + Test2::API::InterceptResult::Hub 1.302205 + Test2::API::InterceptResult::Squasher 1.302205 + Test2::API::Stack 1.302205 + Test2::AsyncSubtest 1.302205 + Test2::AsyncSubtest::Event::Attach 1.302205 + Test2::AsyncSubtest::Event::Detach 1.302205 + Test2::AsyncSubtest::Formatter 1.302205 + Test2::AsyncSubtest::Hub 1.302205 + Test2::Bundle 1.302205 + Test2::Bundle::Extended 1.302205 + Test2::Bundle::More 1.302205 + Test2::Bundle::Simple 1.302205 + Test2::Compare 1.302205 + Test2::Compare::Array 1.302205 + Test2::Compare::Bag 1.302205 + Test2::Compare::Base 1.302205 + Test2::Compare::Bool 1.302205 + Test2::Compare::Custom 1.302205 + Test2::Compare::DeepRef 1.302205 + Test2::Compare::Delta 1.302205 + Test2::Compare::Event 1.302205 + Test2::Compare::EventMeta 1.302205 + Test2::Compare::Float 1.302205 + Test2::Compare::Hash 1.302205 + Test2::Compare::Isa 1.302205 + Test2::Compare::Meta 1.302205 + Test2::Compare::Negatable 1.302205 + Test2::Compare::Number 1.302205 + Test2::Compare::Object 1.302205 + Test2::Compare::OrderedSubset 1.302205 + Test2::Compare::Pattern 1.302205 + Test2::Compare::Ref 1.302205 + Test2::Compare::Regex 1.302205 + Test2::Compare::Scalar 1.302205 + Test2::Compare::Set 1.302205 + Test2::Compare::String 1.302205 + Test2::Compare::Undef 1.302205 + Test2::Compare::Wildcard 1.302205 + Test2::Event 1.302205 + Test2::Event::Bail 1.302205 + Test2::Event::Diag 1.302205 + Test2::Event::Encoding 1.302205 + Test2::Event::Exception 1.302205 + Test2::Event::Fail 1.302205 + Test2::Event::Generic 1.302205 + Test2::Event::Note 1.302205 + Test2::Event::Ok 1.302205 + Test2::Event::Pass 1.302205 + Test2::Event::Plan 1.302205 + Test2::Event::Skip 1.302205 + Test2::Event::Subtest 1.302205 + Test2::Event::TAP::Version 1.302205 + Test2::Event::V2 1.302205 + Test2::Event::Waiting 1.302205 + Test2::EventFacet 1.302205 + Test2::EventFacet::About 1.302205 + Test2::EventFacet::Amnesty 1.302205 + Test2::EventFacet::Assert 1.302205 + Test2::EventFacet::Control 1.302205 + Test2::EventFacet::Error 1.302205 + Test2::EventFacet::Hub 1.302205 + Test2::EventFacet::Info 1.302205 + Test2::EventFacet::Info::Table 1.302205 + Test2::EventFacet::Meta 1.302205 + Test2::EventFacet::Parent 1.302205 + Test2::EventFacet::Plan 1.302205 + Test2::EventFacet::Render 1.302205 + Test2::EventFacet::Trace 1.302205 + Test2::Formatter 1.302205 + Test2::Formatter::TAP 1.302205 + Test2::Hub 1.302205 + Test2::Hub::Interceptor 1.302205 + Test2::Hub::Interceptor::Terminator 1.302205 + Test2::Hub::Subtest 1.302205 + Test2::IPC 1.302205 + Test2::IPC::Driver 1.302205 + Test2::IPC::Driver::Files 1.302205 + Test2::Manual 1.302205 + Test2::Manual::Anatomy 1.302205 + Test2::Manual::Anatomy::API 1.302205 + Test2::Manual::Anatomy::Context 1.302205 + Test2::Manual::Anatomy::EndToEnd 1.302205 + Test2::Manual::Anatomy::Event 1.302205 + Test2::Manual::Anatomy::Hubs 1.302205 + Test2::Manual::Anatomy::IPC 1.302205 + Test2::Manual::Anatomy::Utilities 1.302205 + Test2::Manual::Concurrency 1.302205 + Test2::Manual::Contributing 1.302205 + Test2::Manual::Testing 1.302205 + Test2::Manual::Testing::Introduction 1.302205 + Test2::Manual::Testing::Migrating 1.302205 + Test2::Manual::Testing::Planning 1.302205 + Test2::Manual::Testing::Todo 1.302205 + Test2::Manual::Tooling 1.302205 + Test2::Manual::Tooling::FirstTool 1.302205 + Test2::Manual::Tooling::Formatter 1.302205 + Test2::Manual::Tooling::Nesting 1.302205 + Test2::Manual::Tooling::Plugin::TestExit 1.302205 + Test2::Manual::Tooling::Plugin::TestingDone 1.302205 + Test2::Manual::Tooling::Plugin::ToolCompletes 1.302205 + Test2::Manual::Tooling::Plugin::ToolStarts 1.302205 + Test2::Manual::Tooling::Subtest 1.302205 + Test2::Manual::Tooling::TestBuilder 1.302205 + Test2::Manual::Tooling::Testing 1.302205 + Test2::Mock 1.302205 + Test2::Plugin 1.302205 + Test2::Plugin::BailOnFail 1.302205 + Test2::Plugin::DieOnFail 1.302205 + Test2::Plugin::ExitSummary 1.302205 + Test2::Plugin::SRand 1.302205 + Test2::Plugin::Times 1.302205 + Test2::Plugin::UTF8 1.302205 + Test2::Require 1.302205 + Test2::Require::AuthorTesting 1.302205 + Test2::Require::AutomatedTesting 1.302205 + Test2::Require::EnvVar 1.302205 + Test2::Require::ExtendedTesting 1.302205 + Test2::Require::Fork 1.302205 + Test2::Require::Module 1.302205 + Test2::Require::NonInteractiveTesting 1.302205 + Test2::Require::Perl 1.302205 + Test2::Require::RealFork 1.302205 + Test2::Require::ReleaseTesting 1.302205 + Test2::Require::Threads 1.302205 + Test2::Suite 1.302205 + Test2::Todo 1.302205 + Test2::Tools 1.302205 + Test2::Tools::AsyncSubtest 1.302205 + Test2::Tools::Basic 1.302205 + Test2::Tools::Class 1.302205 + Test2::Tools::ClassicCompare 1.302205 + Test2::Tools::Compare 1.302205 + Test2::Tools::Defer 1.302205 + Test2::Tools::Encoding 1.302205 + Test2::Tools::Event 1.302205 + Test2::Tools::Exception 1.302205 + Test2::Tools::Exports 1.302205 + Test2::Tools::GenTemp 1.302205 + Test2::Tools::Grab 1.302205 + Test2::Tools::Mock 1.302205 + Test2::Tools::Ref 1.302205 + Test2::Tools::Refcount 1.302205 + Test2::Tools::Spec 1.302205 + Test2::Tools::Subtest 1.302205 + Test2::Tools::Target 1.302205 + Test2::Tools::Tester 1.302205 + Test2::Tools::Tiny 1.302205 + Test2::Tools::Warnings 1.302205 + Test2::Util 1.302205 + Test2::Util::ExternalMeta 1.302205 + Test2::Util::Facets2Legacy 1.302205 + Test2::Util::Grabber 1.302205 + Test2::Util::Guard 1.302205 + Test2::Util::HashBase 1.302205 + Test2::Util::Importer 1.302205 + Test2::Util::Ref 1.302205 + Test2::Util::Stash 1.302205 + Test2::Util::Sub 1.302205 + Test2::Util::Table 1.302205 + Test2::Util::Table::Cell 1.302205 + Test2::Util::Table::LineBreak 1.302205 + Test2::Util::Term 1.302205 + Test2::Util::Times 1.302205 + Test2::Util::Trace 1.302205 + Test2::V0 1.302205 + Test2::Workflow 1.302205 + Test2::Workflow::BlockBase 1.302205 + Test2::Workflow::Build 1.302205 + Test2::Workflow::Runner 1.302205 + Test2::Workflow::Task 1.302205 + Test2::Workflow::Task::Action 1.302205 + Test2::Workflow::Task::Group 1.302205 + Test::Builder 1.302205 + Test::Builder::Formatter 1.302205 + Test::Builder::IO::Scalar 1.302205 + Test::Builder::Module 1.302205 + Test::Builder::Tester 1.302205 + Test::Builder::Tester::Color 1.302205 + Test::Builder::Tester::Tie 1.302205 + Test::Builder::TodoDiag 1.302205 + Test::More 1.302205 + Test::Simple 1.302205 + Test::Tester 1.302205 + Test::Tester::Capture 1.302205 + Test::Tester::CaptureRunner 1.302205 + Test::Tester::Delegate 1.302205 + Test::use::ok 1.302205 + ok 1.302205 requirements: B 0 Data::Dumper 0 diff --git a/bin/cpanm b/bin/cpanm index 9107dba1b..7a90c8cfc 100755 --- a/bin/cpanm +++ b/bin/cpanm @@ -109,7 +109,7 @@ $fatpacked{"CPAN/Meta/YAML.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<' CPAN_META_YAML $fatpacked{"Capture/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'CAPTURE_TINY'; - use 5.006;use strict;use warnings;package Capture::Tiny;our$VERSION='0.48';use Carp ();use Exporter ();use IO::Handle ();use File::Spec ();use File::Temp qw/tempfile tmpnam/;use Scalar::Util qw/reftype blessed/;BEGIN {local $@;eval {require PerlIO;PerlIO->can('get_layers')}or *PerlIO::get_layers=sub {return ()}}my%api=(capture=>[1,1,0,0],capture_stdout=>[1,0,0,0],capture_stderr=>[0,1,0,0],capture_merged=>[1,1,1,0],tee=>[1,1,0,1],tee_stdout=>[1,0,0,1],tee_stderr=>[0,1,0,1],tee_merged=>[1,1,1,1],);for my$sub (keys%api){my$args=join q{, },@{$api{$sub}};eval "sub $sub(&;@) {unshift \@_, $args; goto \\&_capture_tee;}"}our@ISA=qw/Exporter/;our@EXPORT_OK=keys%api;our%EXPORT_TAGS=('all'=>\@EXPORT_OK);my$IS_WIN32=$^O eq 'MSWin32';our$TIMEOUT=30;my@cmd=($^X,'-C0','-e',<<'HERE');sub _relayer {my ($fh,$apply_layers)=@_;binmode($fh,":raw");while (1 < (my$layers=()=PerlIO::get_layers($fh,output=>1))){binmode($fh,":pop")}my@to_apply=@$apply_layers;shift@to_apply;binmode($fh,":" .join(":",@to_apply))}sub _name {my$glob=shift;no strict 'refs';return *{$glob}{NAME}}sub _open {open $_[0],$_[1]or Carp::confess "Error from open(" .join(q{, },@_)."): $!"}sub _close {close $_[0]or Carp::confess "Error from close(" .join(q{, },@_)."): $!"}my%dup;my%proxy_count;sub _proxy_std {my%proxies;if (!defined fileno STDIN){$proxy_count{stdin}++;if (defined$dup{stdin}){_open \*STDIN,"<&=" .fileno($dup{stdin})}else {_open \*STDIN,"<" .File::Spec->devnull;_open$dup{stdin}=IO::Handle->new,"<&=STDIN"}$proxies{stdin}=\*STDIN;binmode(STDIN,':utf8')if $] >= 5.008}if (!defined fileno STDOUT){$proxy_count{stdout}++;if (defined$dup{stdout}){_open \*STDOUT,">&=" .fileno($dup{stdout})}else {_open \*STDOUT,">" .File::Spec->devnull;_open$dup{stdout}=IO::Handle->new,">&=STDOUT"}$proxies{stdout}=\*STDOUT;binmode(STDOUT,':utf8')if $] >= 5.008}if (!defined fileno STDERR){$proxy_count{stderr}++;if (defined$dup{stderr}){_open \*STDERR,">&=" .fileno($dup{stderr})}else {_open \*STDERR,">" .File::Spec->devnull;_open$dup{stderr}=IO::Handle->new,">&=STDERR"}$proxies{stderr}=\*STDERR;binmode(STDERR,':utf8')if $] >= 5.008}return%proxies}sub _unproxy {my (%proxies)=@_;for my$p (keys%proxies){$proxy_count{$p}--;if (!$proxy_count{$p}){_close$proxies{$p};_close$dup{$p}unless $] < 5.008;delete$dup{$p}}}}sub _copy_std {my%handles;for my$h (qw/stdout stderr stdin/){next if$h eq 'stdin' &&!$IS_WIN32;my$redir=$h eq 'stdin' ? "<&" : ">&";_open$handles{$h}=IO::Handle->new(),$redir .uc($h)}return \%handles}sub _open_std {my ($handles)=@_;_open \*STDIN,"<&" .fileno$handles->{stdin}if defined$handles->{stdin};_open \*STDOUT,">&" .fileno$handles->{stdout}if defined$handles->{stdout};_open \*STDERR,">&" .fileno$handles->{stderr}if defined$handles->{stderr}}sub _start_tee {my ($which,$stash)=@_;$stash->{$_}{$which}=IO::Handle->new for qw/tee reader/;pipe$stash->{reader}{$which},$stash->{tee}{$which};select((select($stash->{tee}{$which}),$|=1)[0]);$stash->{new}{$which}=$stash->{tee}{$which};$stash->{child}{$which}={stdin=>$stash->{reader}{$which},stdout=>$stash->{old}{$which},stderr=>$stash->{capture}{$which},};$stash->{flag_files}{$which}=scalar(tmpnam()).$$;if ($IS_WIN32){my$old_eval_err=$@;undef $@;eval "use Win32API::File qw/GetOsFHandle SetHandleInformation fileLastError HANDLE_FLAG_INHERIT INVALID_HANDLE_VALUE/ ";my$os_fhandle=GetOsFHandle($stash->{tee}{$which});my$result=SetHandleInformation($os_fhandle,HANDLE_FLAG_INHERIT(),0);_open_std($stash->{child}{$which});$stash->{pid}{$which}=system(1,@cmd,$stash->{flag_files}{$which});$@=$old_eval_err}else {_fork_exec($which,$stash)}}sub _fork_exec {my ($which,$stash)=@_;my$pid=fork;if (not defined$pid){Carp::confess "Couldn't fork(): $!"}elsif ($pid==0){untie*STDIN;untie*STDOUT;untie*STDERR;_close$stash->{tee}{$which};_open_std($stash->{child}{$which});exec@cmd,$stash->{flag_files}{$which}}$stash->{pid}{$which}=$pid}my$have_usleep=eval "use Time::HiRes 'usleep'; 1";sub _files_exist {return 1 if @_==grep {-f}@_;Time::HiRes::usleep(1000)if$have_usleep;return 0}sub _wait_for_tees {my ($stash)=@_;my$start=time;my@files=values %{$stash->{flag_files}};my$timeout=defined$ENV{PERL_CAPTURE_TINY_TIMEOUT}? $ENV{PERL_CAPTURE_TINY_TIMEOUT}: $TIMEOUT;1 until _files_exist(@files)|| ($timeout && (time - $start > $timeout));Carp::confess "Timed out waiting for subprocesses to start" if!_files_exist(@files);unlink $_ for@files}sub _kill_tees {my ($stash)=@_;if ($IS_WIN32){close($_)for values %{$stash->{tee}};my$start=time;1 until wait==-1 || (time - $start > 30)}else {_close $_ for values %{$stash->{tee}};waitpid $_,0 for values %{$stash->{pid}}}}sub _slurp {my ($name,$stash)=@_;my ($fh,$pos)=map {$stash->{$_}{$name}}qw/capture pos/;seek($fh,$pos,0)or die "Couldn't seek on capture handle for $name\n";my$text=do {local $/;scalar readline$fh};return defined($text)? $text : ""}sub _capture_tee {my ($do_stdout,$do_stderr,$do_merge,$do_tee,$code,@opts)=@_;my%do=($do_stdout ? (stdout=>1): (),$do_stderr ? (stderr=>1): ());Carp::confess("Custom capture options must be given as key/value pairs\n")unless@opts % 2==0;my$stash={capture=>{@opts }};for (keys %{$stash->{capture}}){my$fh=$stash->{capture}{$_};Carp::confess "Custom handle for $_ must be seekable\n" unless ref($fh)eq 'GLOB' || (blessed($fh)&& $fh->isa("IO::Seekable"))}local*CT_ORIG_STDIN=*STDIN ;local*CT_ORIG_STDOUT=*STDOUT;local*CT_ORIG_STDERR=*STDERR;my%layers=(stdin=>[PerlIO::get_layers(\*STDIN)],stdout=>[PerlIO::get_layers(\*STDOUT,output=>1)],stderr=>[PerlIO::get_layers(\*STDERR,output=>1)],);$layers{stdout}=[PerlIO::get_layers(tied*STDOUT)]if tied(*STDOUT)&& (reftype tied*STDOUT eq 'GLOB');$layers{stderr}=[PerlIO::get_layers(tied*STDERR)]if tied(*STDERR)&& (reftype tied*STDERR eq 'GLOB');my%localize;$localize{stdin}++,local(*STDIN)if grep {$_ eq 'scalar'}@{$layers{stdin}};$localize{stdout}++,local(*STDOUT)if$do_stdout && grep {$_ eq 'scalar'}@{$layers{stdout}};$localize{stderr}++,local(*STDERR)if ($do_stderr || $do_merge)&& grep {$_ eq 'scalar'}@{$layers{stderr}};$localize{stdin}++,local(*STDIN),_open(\*STDIN,"<&=0")if tied*STDIN && $] >= 5.008;$localize{stdout}++,local(*STDOUT),_open(\*STDOUT,">&=1")if$do_stdout && tied*STDOUT && $] >= 5.008;$localize{stderr}++,local(*STDERR),_open(\*STDERR,">&=2")if ($do_stderr || $do_merge)&& tied*STDERR && $] >= 5.008;my%proxy_std=_proxy_std();$layers{stdout}=[PerlIO::get_layers(\*STDOUT,output=>1)]if$proxy_std{stdout};$layers{stderr}=[PerlIO::get_layers(\*STDERR,output=>1)]if$proxy_std{stderr};$stash->{old}=_copy_std();$stash->{new}={%{$stash->{old}}};for (keys%do){$stash->{new}{$_}=($stash->{capture}{$_}||= File::Temp->new);seek($stash->{capture}{$_},0,2)or die "Could not seek on capture handle for $_\n";$stash->{pos}{$_}=tell$stash->{capture}{$_};_start_tee($_=>$stash)if$do_tee}_wait_for_tees($stash)if$do_tee;$stash->{new}{stderr}=$stash->{new}{stdout}if$do_merge;_open_std($stash->{new});my ($exit_code,$inner_error,$outer_error,$orig_pid,@result);{$orig_pid=$$;local*STDIN=*CT_ORIG_STDIN if$localize{stdin};_relayer(\*STDOUT,$layers{stdout})if$do_stdout;_relayer(\*STDERR,$layers{stderr})if$do_stderr;my$old_eval_err=$@;undef $@;eval {@result=$code->();$inner_error=$@};$exit_code=$?;$outer_error=$@;STDOUT->flush if$do_stdout;STDERR->flush if$do_stderr;$@=$old_eval_err}_open_std($stash->{old});_close($_)for values %{$stash->{old}};_relayer(\*STDOUT,$layers{stdout})if$do_stdout;_relayer(\*STDERR,$layers{stderr})if$do_stderr;_unproxy(%proxy_std);_kill_tees($stash)if$do_tee;my%got;if ($orig_pid==$$ and (defined wantarray or ($do_tee && keys%localize))){for (keys%do){_relayer($stash->{capture}{$_},$layers{$_});$got{$_}=_slurp($_,$stash)}print CT_ORIG_STDOUT$got{stdout}if$do_stdout && $do_tee && $localize{stdout};print CT_ORIG_STDERR$got{stderr}if$do_stderr && $do_tee && $localize{stderr}}$?=$exit_code;$@=$inner_error if$inner_error;die$outer_error if$outer_error;return unless defined wantarray;my@return;push@return,$got{stdout}if$do_stdout;push@return,$got{stderr}if$do_stderr &&!$do_merge;push@return,@result;return wantarray ? @return : $return[0]}1; + use 5.006;use strict;use warnings;package Capture::Tiny;our$VERSION='0.50';use Carp ();use Exporter ();use IO::Handle ();use File::Spec ();use File::Temp qw/tempfile tmpnam/;use Scalar::Util qw/reftype blessed/;BEGIN {local $@;eval {require PerlIO;PerlIO->can('get_layers')}or *PerlIO::get_layers=sub {return ()}}my%api=(capture=>[1,1,0,0],capture_stdout=>[1,0,0,0],capture_stderr=>[0,1,0,0],capture_merged=>[1,1,1,0],tee=>[1,1,0,1],tee_stdout=>[1,0,0,1],tee_stderr=>[0,1,0,1],tee_merged=>[1,1,1,1],);for my$sub (keys%api){my$args=join q{, },@{$api{$sub}};eval "sub $sub(&;@) {unshift \@_, $args; goto \\&_capture_tee;}"}our@ISA=qw/Exporter/;our@EXPORT_OK=keys%api;our%EXPORT_TAGS=('all'=>\@EXPORT_OK);my$IS_WIN32=$^O eq 'MSWin32';our$TIMEOUT=30;my@cmd=($^X,'-C0','-e',<<'HERE');sub _relayer {my ($fh,$apply_layers)=@_;binmode($fh,":raw");while (1 < (my$layers=()=PerlIO::get_layers($fh,output=>1))){binmode($fh,":pop")}my@to_apply=@$apply_layers;shift@to_apply;binmode($fh,":" .join(":",@to_apply))}sub _name {my$glob=shift;no strict 'refs';return *{$glob}{NAME}}sub _open {open $_[0],$_[1]or Carp::confess "Error from open(" .join(q{, },@_)."): $!"}sub _close {close $_[0]or Carp::confess "Error from close(" .join(q{, },@_)."): $!"}my%dup;my%proxy_count;sub _proxy_std {my%proxies;if (!defined fileno STDIN){$proxy_count{stdin}++;if (defined$dup{stdin}){_open \*STDIN,"<&=" .fileno($dup{stdin})}else {_open \*STDIN,"<" .File::Spec->devnull;_open$dup{stdin}=IO::Handle->new,"<&=STDIN"}$proxies{stdin}=\*STDIN;binmode(STDIN,':utf8')if $] >= 5.008}if (!defined fileno STDOUT){$proxy_count{stdout}++;if (defined$dup{stdout}){_open \*STDOUT,">&=" .fileno($dup{stdout})}else {_open \*STDOUT,">" .File::Spec->devnull;_open$dup{stdout}=IO::Handle->new,">&=STDOUT"}$proxies{stdout}=\*STDOUT;binmode(STDOUT,':utf8')if $] >= 5.008}if (!defined fileno STDERR){$proxy_count{stderr}++;if (defined$dup{stderr}){_open \*STDERR,">&=" .fileno($dup{stderr})}else {_open \*STDERR,">" .File::Spec->devnull;_open$dup{stderr}=IO::Handle->new,">&=STDERR"}$proxies{stderr}=\*STDERR;binmode(STDERR,':utf8')if $] >= 5.008}return%proxies}sub _unproxy {my (%proxies)=@_;for my$p (keys%proxies){$proxy_count{$p}--;if (!$proxy_count{$p}){_close$proxies{$p};_close$dup{$p}unless $] < 5.008;delete$dup{$p}}}}sub _copy_std {my%handles;for my$h (qw/stdout stderr stdin/){next if$h eq 'stdin' &&!$IS_WIN32;my$redir=$h eq 'stdin' ? "<&" : ">&";_open$handles{$h}=IO::Handle->new(),$redir .uc($h)}return \%handles}sub _open_std {my ($handles)=@_;_open \*STDIN,"<&" .fileno$handles->{stdin}if defined$handles->{stdin};_open \*STDOUT,">&" .fileno$handles->{stdout}if defined$handles->{stdout};_open \*STDERR,">&" .fileno$handles->{stderr}if defined$handles->{stderr}}sub _start_tee {my ($which,$stash)=@_;$stash->{$_}{$which}=IO::Handle->new for qw/tee reader/;pipe$stash->{reader}{$which},$stash->{tee}{$which};select((select($stash->{tee}{$which}),$|=1)[0]);$stash->{new}{$which}=$stash->{tee}{$which};$stash->{child}{$which}={stdin=>$stash->{reader}{$which},stdout=>$stash->{old}{$which},stderr=>$stash->{capture}{$which},};$stash->{flag_files}{$which}=scalar(tmpnam()).$$;if ($IS_WIN32){my$old_eval_err=$@;undef $@;eval "use Win32API::File qw/GetOsFHandle SetHandleInformation fileLastError HANDLE_FLAG_INHERIT INVALID_HANDLE_VALUE/ ";my$os_fhandle=GetOsFHandle($stash->{tee}{$which});my$result=SetHandleInformation($os_fhandle,HANDLE_FLAG_INHERIT(),0);_open_std($stash->{child}{$which});$stash->{pid}{$which}=system(1,@cmd,$stash->{flag_files}{$which});$@=$old_eval_err}else {_fork_exec($which,$stash)}}sub _fork_exec {my ($which,$stash)=@_;my$pid=fork;if (not defined$pid){Carp::confess "Couldn't fork(): $!"}elsif ($pid==0){untie*STDIN;untie*STDOUT;untie*STDERR;_close$stash->{tee}{$which};_open_std($stash->{child}{$which});exec@cmd,$stash->{flag_files}{$which}}$stash->{pid}{$which}=$pid}my$have_usleep=eval "use Time::HiRes 'usleep'; 1";sub _files_exist {return 1 if @_==grep {-f}@_;Time::HiRes::usleep(1000)if$have_usleep;return 0}sub _wait_for_tees {my ($stash)=@_;my$start=time;my@files=values %{$stash->{flag_files}};my$timeout=defined$ENV{PERL_CAPTURE_TINY_TIMEOUT}? $ENV{PERL_CAPTURE_TINY_TIMEOUT}: $TIMEOUT;1 until _files_exist(@files)|| ($timeout && (time - $start > $timeout));Carp::confess "Timed out waiting for subprocesses to start" if!_files_exist(@files);unlink $_ for@files}sub _kill_tees {my ($stash)=@_;if ($IS_WIN32){close($_)for values %{$stash->{tee}};my$start=time;1 until wait==-1 || (time - $start > 30)}else {_close $_ for values %{$stash->{tee}};waitpid $_,0 for values %{$stash->{pid}}}}sub _slurp {my ($name,$stash)=@_;my ($fh,$pos)=map {$stash->{$_}{$name}}qw/capture pos/;seek($fh,$pos,0)or die "Couldn't seek on capture handle for $name\n";my$text=do {local $/;scalar readline$fh};return defined($text)? $text : ""}sub _capture_tee {my ($do_stdout,$do_stderr,$do_merge,$do_tee,$code,@opts)=@_;my%do=($do_stdout ? (stdout=>1): (),$do_stderr ? (stderr=>1): ());Carp::confess("Custom capture options must be given as key/value pairs\n")unless@opts % 2==0;my$stash={capture=>{@opts }};for (keys %{$stash->{capture}}){my$fh=$stash->{capture}{$_};Carp::confess "Custom handle for $_ must be seekable\n" unless ref($fh)eq 'GLOB' || (blessed($fh)&& $fh->isa("IO::Seekable"))}local*CT_ORIG_STDIN=*STDIN ;local*CT_ORIG_STDOUT=*STDOUT;local*CT_ORIG_STDERR=*STDERR;my%layers=(stdin=>[PerlIO::get_layers(\*STDIN)],stdout=>[PerlIO::get_layers(\*STDOUT,output=>1)],stderr=>[PerlIO::get_layers(\*STDERR,output=>1)],);$layers{stdout}=[PerlIO::get_layers(tied*STDOUT)]if tied(*STDOUT)&& (reftype tied*STDOUT eq 'GLOB');$layers{stderr}=[PerlIO::get_layers(tied*STDERR)]if tied(*STDERR)&& (reftype tied*STDERR eq 'GLOB');my%localize;$localize{stdin}++,local(*STDIN)if grep {$_ eq 'scalar'}@{$layers{stdin}};$localize{stdout}++,local(*STDOUT)if$do_stdout && grep {$_ eq 'scalar'}@{$layers{stdout}};$localize{stderr}++,local(*STDERR)if ($do_stderr || $do_merge)&& grep {$_ eq 'scalar'}@{$layers{stderr}};$localize{stdin}++,local(*STDIN),_open(\*STDIN,"<&=0")if tied*STDIN && $] >= 5.008;$localize{stdout}++,local(*STDOUT),_open(\*STDOUT,">&=1")if$do_stdout && tied*STDOUT && $] >= 5.008;$localize{stderr}++,local(*STDERR),_open(\*STDERR,">&=2")if ($do_stderr || $do_merge)&& tied*STDERR && $] >= 5.008;my%proxy_std=_proxy_std();$layers{stdout}=[PerlIO::get_layers(\*STDOUT,output=>1)]if$proxy_std{stdout};$layers{stderr}=[PerlIO::get_layers(\*STDERR,output=>1)]if$proxy_std{stderr};$stash->{old}=_copy_std();$stash->{new}={%{$stash->{old}}};for (keys%do){$stash->{new}{$_}=($stash->{capture}{$_}||= File::Temp->new);seek($stash->{capture}{$_},0,2)or die "Could not seek on capture handle for $_\n";$stash->{pos}{$_}=tell$stash->{capture}{$_};_start_tee($_=>$stash)if$do_tee}_wait_for_tees($stash)if$do_tee;$stash->{new}{stderr}=$stash->{new}{stdout}if$do_merge;_open_std($stash->{new});my ($exit_code,$inner_error,$outer_error,$orig_pid,@result);{$orig_pid=$$;local*STDIN=*CT_ORIG_STDIN if$localize{stdin};_relayer(\*STDOUT,$layers{stdout})if$do_stdout;_relayer(\*STDERR,$layers{stderr})if$do_stderr;my$old_eval_err=$@;undef $@;eval {@result=$code->();$inner_error=$@};$exit_code=$?;$outer_error=$@;STDOUT->flush if$do_stdout;STDERR->flush if$do_stderr;$@=$old_eval_err}_open_std($stash->{old});_close($_)for values %{$stash->{old}};_relayer(\*STDOUT,$layers{stdout})if$do_stdout;_relayer(\*STDERR,$layers{stderr})if$do_stderr;_unproxy(%proxy_std);_kill_tees($stash)if$do_tee;my%got;if ($orig_pid==$$ and (defined wantarray or ($do_tee && keys%localize))){for (keys%do){_relayer($stash->{capture}{$_},$layers{$_});$got{$_}=_slurp($_,$stash)}print CT_ORIG_STDOUT$got{stdout}if$do_stdout && $do_tee && $localize{stdout};print CT_ORIG_STDERR$got{stderr}if$do_stderr && $do_tee && $localize{stderr}}$?=$exit_code;$@=$inner_error if$inner_error;die$outer_error if$outer_error;return unless defined wantarray;my@return;push@return,$got{stdout}if$do_stdout;push@return,$got{stderr}if$do_stderr &&!$do_merge;push@return,@result;return wantarray ? @return : $return[0]}1; use Fcntl; $SIG{HUP}=sub{exit}; if ( my $fn=shift ) {