File Coverage

corpus/dist1/xt/lib/Local/Test.pm
Criterion Covered Total %
statement 33 34 97.0
branch 7 14 50.0
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 46 56 82.1


line stmt bran cond sub pod time code
1             package Local::Test;
2              
3 5     5   2380 use 5.006;
  5         21  
4 5     5   50 use strict;
  5         11  
  5         143  
5 5     5   26 use warnings;
  5         13  
  5         276  
6              
7             our $VERSION = '0.001';
8              
9 5     5   34 use parent 'XT::Files::Plugin';
  5         8  
  5         42  
10              
11             sub BUILD {
12 9     9 0 30 my ( $self, $args ) = @_;
13              
14 9         21 my $report_file = $ENV{REPORT_FILE_BASE};
15 9 50       24 die 'Environment variable REPORT_FILE not set' if !defined $report_file;
16 9         18 $report_file .= '.new';
17              
18 9 50       627 open my $fh, '>', $report_file or die "Unable to write file $report_file: $!";
19             ARG:
20 9         29 for my $key ( sort keys %{$args} ) {
  9         42  
21 9 50       37 next ARG if $key eq 'xtf';
22 0         0 print $fh "$key=$args->{$key}\n";
23             }
24 9 50       103 close $fh or die "Unable to write file $report_file: $!";
25              
26 9         56 return $self;
27             }
28              
29             sub run {
30 9     9 0 19 my ( $self, $args ) = @_;
31              
32 9         24 my $report_file = $ENV{REPORT_FILE_BASE};
33 9 50       24 die 'Environment variable REPORT_FILE not set' if !defined $report_file;
34 9         20 $report_file .= '.run';
35              
36 9 50       513 open my $fh, '>', $report_file or die "Unable to write file $report_file: $!";
37 9         23 for my $arg ( @{$args} ) {
  9         24  
38 25         36 my ( $key, $value ) = @{$arg};
  25         59  
39 25         149 print $fh "$key=$value\n";
40             }
41 9 50       328 close $fh or die "Unable to write file $report_file: $!";
42              
43 9         57 return;
44             }
45              
46             1;
47              
48             # vim: ts=4 sts=4 sw=4 et: syntax=perl