From 092a56fa4f08130067307e99edd5d050bf165959 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 10 Dec 2015 12:56:44 +0000 Subject: [PATCH] Bug 14939: Remove the Capture::Tiny dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's possible to redirect the std output to a variable, it will avoid to add this new dependency. Signed-off-by: Frédéric Demians OK. + code factorisation with a function call. --- C4/Installer/PerlDependencies.pm | 5 ----- t/db_dependent/OAI/Server.t | 15 ++++++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index c2ed83a..c1d03c7 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -782,11 +782,6 @@ our $PERL_DEPS = { 'required' => '1', 'min_ver' => '1.10', }, - 'Capture::Tiny' => { - 'usage' => 'Core', - 'required' => '0', - 'min_ver' => '0.18', - }, }; 1; diff --git a/t/db_dependent/OAI/Server.t b/t/db_dependent/OAI/Server.t index 2147068..4e2d626 100644 --- a/t/db_dependent/OAI/Server.t +++ b/t/db_dependent/OAI/Server.t @@ -25,7 +25,6 @@ use Test::More tests => 13; use Test::MockModule; use Test::Warn; use DateTime; -use Capture::Tiny ':all'; use XML::Simple; use t::lib::Mocks; @@ -74,8 +73,15 @@ t::lib::Mocks::mock_preference('OAI-PMH:MaxCount', 3); t::lib::Mocks::mock_preference('OAI-PMH:DeletedRecord', 'persistent'); %param = ( verb => 'ListMetadataFormats' ); -my ($response) = capture { Koha::OAI::Server::Repository->new(); }; -$response = XMLin($response); +my $response; +my $get_response = sub { + my $stdout; + local *STDOUT; + open STDOUT, '>', \$stdout; + Koha::OAI::Server::Repository->new(); + $response = XMLin($stdout); +}; +$get_response->(); my $now = DateTime->now . 'Z'; my $expected = { request => 'http://localhost', @@ -101,8 +107,7 @@ my $expected = { is_deeply($response, $expected, "ListMetadataFormats"); %param = ( verb => 'ListIdentifiers' ); -($response) = capture { Koha::OAI::Server::Repository->new(); }; -$response = XMLin($response); +$get_response->(); $now = DateTime->now . 'Z'; $expected = { request => 'http://localhost', -- 2.6.2