File Coverage

File:Quux.pm
Coverage:86.4%

linestmtbrancondsubpodtimecode
1package Quux;
2
3#===============================================================================
4# REVISION: $Id:$
5# DESCRIPTION: Test module
6#===============================================================================
7
8
1
1
1
3
1
3
use strict;
9
1
1
1
3
1
4
use warnings;
10
11our $VERSION = qw($Revision$) [1];
12
13
1
1
1
4
1
3
use Readonly;
14
1
1
1
3
1
3
use English qw( -no_match_vars );
15
1
1
1
4
1
3
use Carp;
16
17## no critic (RequireCarping)
18
19sub new {
20
1
0
3
    my $class = shift;
21
22
1
7
    return bless {}, $class;
23}
24
25sub foo {
26
3
0
38
    my $self = shift;
27
3
6
    my $file_name = shift;
28
3
21
    my $var1 = shift;
29
3
4
    my $var2 = shift;
30
3
22
    my $flag = shift || $ENV{'FLAG'} || 1;
31
32
3
50
    open my $fh, '>>', $file_name
33        or die "Cannot open file '$file_name': $OS_ERROR";
34
35
2
5
    if ($var1) {
36
1
1
1
13
        print {$fh} $var1;
37    }
38    else {
39
1
15
        warn 'var1 is not saved!';
40    }
41
42
2
5
    if ($var2) {
43
1
1
1
3
        print {$fh} $var2;
44    }
45    else {
46
1
6
        warn 'var2 is not saved!';
47    }
48
49    # This should not happen in practice!
50
2
11
    close $fh or die "Cannot close file '$file_name': $OS_ERROR";
51
52
2
3
    return 1;
53}
54
55sub not_tested {
56
0
0
    my $self = shift;
57
58
0
    return;
59}
60
611;