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 4     4   1844 use 5.006;
  4         13  
4 4     4   45 use strict;
  4         9  
  4         113  
5 4     4   22 use warnings;
  4         7  
  4         220  
6              
7             our $VERSION = '0.001';
8              
9 4     4   34 use parent 'XT::Files::Plugin';
  4         8  
  4         26  
10              
11             sub BUILD {
12 8     8 0 28 my ( $self, $args ) = @_;
13              
14 8         18 my $report_file = $ENV{REPORT_FILE_BASE};
15 8 50       21 die 'Environment variable REPORT_FILE not set' if !defined $report_file;
16 8         16 $report_file .= '.new';
17              
18 8 50       573 open my $fh, '>', $report_file or die "Unable to write file $report_file: $!";
19             ARG:
20 8         22 for my $key ( sort keys %{$args} ) {
  8         38  
21 8 50       28 next ARG if $key eq 'xtf';
22 0         0 print $fh "$key=$args->{$key}\n";
23             }
24 8 50       88 close $fh or die "Unable to write file $report_file: $!";
25              
26 8         49 return $self;
27             }
28              
29             sub run {
30 8     8 0 18 my ( $self, $args ) = @_;
31              
32 8         19 my $report_file = $ENV{REPORT_FILE_BASE};
33 8 50       19 die 'Environment variable REPORT_FILE not set' if !defined $report_file;
34 8         17 $report_file .= '.run';
35              
36 8 50       435 open my $fh, '>', $report_file or die "Unable to write file $report_file: $!";
37 8         20 for my $arg ( @{$args} ) {
  8         18  
38 21         36 my ( $key, $value ) = @{$arg};
  21         44  
39 21         122 print $fh "$key=$value\n";
40             }
41 8 50       313 close $fh or die "Unable to write file $report_file: $!";
42              
43 8         50 return;
44             }
45              
46             1;
47              
48             # vim: ts=4 sts=4 sw=4 et: syntax=perl