Bug 14939: Remove the Capture::Tiny dependency
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 10 Dec 2015 12:56:44 +0000 (12:56 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 31 Dec 2015 15:15:35 +0000 (15:15 +0000)
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 <f.demians@tamil.fr>
  OK. + code factorisation with a function call.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Installer/PerlDependencies.pm
t/db_dependent/OAI/Server.t

index 99fd9aa..778e101 100644 (file)
@@ -787,11 +787,6 @@ our $PERL_DEPS = {
         'required' => '0',
         'min_ver'  => '0.03',
     },
-    'Capture::Tiny' => {
-        'usage'    => 'Core',
-        'required' => '0',
-        'min_ver'  => '0.18',
-    },
 };
 
 1;
index 2147068..4e2d626 100644 (file)
@@ -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',