File Coverage

blib/lib/Ixchel/Actions/install_cpanm.pm
Criterion Covered Total %
statement 14 26 53.8
branch 0 4 0.0
condition n/a
subroutine 5 8 62.5
pod 2 3 66.6
total 21 41 51.2


line stmt bran cond sub pod time code
1             package Ixchel::Actions::install_cpanm;
2              
3 1     1   92306 use 5.006;
  1         3  
4 1     1   5 use strict;
  1         1  
  1         29  
5 1     1   5 use warnings;
  1         1  
  1         53  
6 1     1   508 use Ixchel::functions::install_cpanm;
  1         9  
  1         102  
7 1     1   7 use base 'Ixchel::Actions::base';
  1         3  
  1         42  
8              
9             =head1 NAME
10              
11             Ixchel::Actions::install_cpanm - Install cpanm via packages.
12              
13             =head1 VERSION
14              
15             Version 0.2.0
16              
17             =cut
18              
19             our $VERSION = '0.2.0';
20              
21             =head1 CLI SYNOPSIS
22              
23             ixchel -a install_cpanm
24              
25             =head1 CODE SYNOPSIS
26              
27             use Data::Dumper;
28              
29             my $results=$ixchel->action(action=>'install_cpanm', opts=>{});
30              
31             =head1 RESULT HASH REF
32              
33             .errors :: A array of errors encountered.
34             .status_text :: A string description of what was done and the results.
35             .ok :: Set to zero if any of the above errored.
36              
37             =cut
38              
39       0 0   sub new_extra {
40             } ## end sub new
41              
42             sub action {
43 0     0 1   my $self = $_[0];
44              
45 0           $self->status_add(status=>'Installing cpanm via packges');
46              
47 0           eval{
48 0           install_cpanm;
49             };
50 0 0         if ($@) {
51 0           $self->status_add(status=>'Failed to install cpanm via packages ... '.$@, error=>1);
52             }else {
53 0           $self->status_add(status=>'cpanm installed');
54             }
55              
56 0 0         if (!defined($self->{results}{errors}[0])) {
57 0           $self->{results}{ok}=1;
58             }else {
59 0           $self->{results}{ok}=0;
60             }
61              
62 0           return $self->{results};
63             } ## end sub action
64              
65             sub short {
66 0     0 1   return 'Install cpanm via packages.';
67             }
68              
69             1;