File Coverage

blib/lib/Rex/Report.pm
Criterion Covered Total %
statement 21 22 95.4
branch 3 4 75.0
condition 7 8 87.5
subroutine 6 6 100.0
pod 0 2 0.0
total 37 42 88.1


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4              
5             package Rex::Report;
6              
7 133     133   1543 use v5.12.5;
  133         492  
8 133     107   788 use warnings;
  107         265  
  107         2794  
9 107     102   608 use Data::Dumper;
  102         185  
  102         21804  
10              
11             our $VERSION = '1.14.2.2'; # TRIAL VERSION
12              
13             my $report;
14              
15             sub create {
16 104     104 0 5170 my ( $class, $type ) = @_;
17 104 100 100     1128 if ( $report && $type && ref($report) =~ m/::\Q$type\E$/ ) { return $report; }
  1   66     22  
18              
19 103   100     1184 $type ||= "Base";
20              
21 103         448 my $c = "Rex::Report::$type";
22 103     67   8160 eval "use $c";
  67         860  
  67         373  
  67         1108  
23              
24 103 50       1922 if ($@) {
25 0         0 die("No reporting class $type found.");
26             }
27              
28 103         616 $report = $c->new;
29 103         1669 return $report;
30             }
31              
32 1     1 0 37 sub destroy { $report = undef; }
33              
34             1;