File Coverage

lib/Rex/Virtualization/Base.pm
Criterion Covered Total %
statement 16 23 69.5
branch 1 2 50.0
condition 0 3 0.0
subroutine 5 6 83.3
pod 0 2 0.0
total 22 36 61.1


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4              
5             package Rex::Virtualization::Base;
6              
7 3     3   39 use v5.12.5;
  3         10  
8 3     3   16 use warnings;
  3         13  
  3         647  
9              
10             our $VERSION = '1.14.2.3'; # TRIAL VERSION
11              
12             sub new {
13 0     0 0 0 my $that = shift;
14 0   0     0 my $proto = ref($that) || $that;
15 0         0 my $self = {@_};
16              
17 0         0 bless( $self, $proto );
18              
19 0         0 return $self;
20             }
21              
22             sub execute {
23 2     2 0 36 my ( $self, $action, $vmname, @opt ) = @_;
24              
25 2         8 my $mod = ref($self) . "::$action";
26 2     1   130 eval "use $mod;";
  1     1   11  
  1         6  
  1         13  
  1         8  
  1         3  
  1         11  
27              
28 2 50       49 if ($@) {
29 0         0 Rex::Logger::info("No action $action available.");
30 0         0 die("No action $action available.");
31             }
32              
33 2         14 return $mod->execute( $vmname, @opt );
34              
35             }
36              
37             1;