Enbld/Command/Selfupgrade.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 44 SCAR 17.9
CC
2
Cov
0%
do
6.0
download_cpanm
2.0
BEGIN
2.0
CRAP 6.0
1 package Enbld::Command::Selfupgrade;
2  
3 use strict;
4 use warnings;
5  
6 use 5.010001;
7  
8 use File::Spec;
9  
10 use parent qw/Enbld::Command/;
11  
12 require Enbld::Home;
13  
14 sub do {
15 Enbld::Home->initialize;
16  
17 my $cpanm = File::Spec->catfile( Enbld::Home->etc, 'cpanm' );
18  
19 download_cpanm() unless ( -e $cpanm );
20  
21 say "=====> Upgrade Enbld.";
22  
23 system( '/usr/bin/perl', $cpanm, 'Enbld', '-L', Enbld::Home->extlib );
24  
25 say "=====> Finish upgrade.";
26  
27 return $_[0];
28 }
29  
30 sub download_cpanm {
31 $File::Fetch::BLACKLIST = [ qw|lwp httptiny| ];
32  
33 my $ff = File::Fetch->new( uri => 'http://xrl.us/cpanm' );
34 my $where = $ff->fetch( to => Enbld::Home->etc ) or die $ff->error;
35  
36 return $where;
37 }
38  
39 1;