Hush/Logger.pm

filter: Statementstmt 73.0% 19 / 26 Branchbran 0.0% 0 / 2 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 57.7% 26 / 45 CC 2 SCAR 8.9
CC
2
Cov
62%
debug
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
« Hush/Util.pm ↑ Summary Hush/Memo.pm »
1 package Hush::Logger;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use File::Spec::Functions;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 our @EXPORT_OK = qw/debug/;
9 1 ▶my $HUSH_CONFIG_DIR = $ENV{HUSH_CONFIG_DIR} || catdir($ENV{HOME},'.hush');
Condition33%1/3
$ENV{'HUSH_CONFIG_DIR'} || catdir($ENV{'HOME'}, '.hush')
l!l&&r!l&&!r
010
MC/DC0%0/2
$ENV{'HUSH_CONFIG_DIR'} || catdir($ENV{'HOME'}, '.hush')
$ENV{'HUSH_CONFIG_DIR'} catdir($ENV{'HOME'}, '.hush')
Truth table33%1/3
A || B
A= $ENV{'HUSH_CONFIG_DIR'}B= catdir($ENV{'HOME'}, '.hush')
ABresult
1X1
011
000
10 1 ▶my $HUSHLIST_CONFIG_DIR = $ENV{HUSH_CONFIG_DIR} || catdir($HUSH_CONFIG_DIR, 'list');
Condition33%1/3
$ENV{'HUSH_CONFIG_DIR'} || catdir($HUSH_CONFIG_DIR, 'list')
l!l&&r!l&&!r
010
MC/DC0%0/2
$ENV{'HUSH_CONFIG_DIR'} || catdir($HUSH_CONFIG_DIR, 'list')
$ENV{'HUSH_CONFIG_DIR'} catdir($HUSH_CONFIG_DIR, 'list')
Truth table33%1/3
A || B
A= $ENV{'HUSH_CONFIG_DIR'}B= catdir($HUSH_CONFIG_DIR, 'list')
ABresult
1X1
011
000
11  
12 0 ▶sub debug {
Subroutine debug: not called CC=2 SCAR=17.9
Pod undocumented
13 0 my ($msg) = @_;
14 0 my $time = localtime();
15 0 my $debug = catfile($HUSHLIST_CONFIG_DIR, 'debug.log');
16 0 ▶ open(my $log, '>>', $debug) or barf("Could not open $debug for writing!!!");
Branch: 1 branch
BranchTrueFalseTotal
open my $log, ">>", $debug or barf("Could not open $debug for writing!!!") 0 0 0
17 0 my $stuff = "[$time] [$$] $msg\n";
18 #print $stuff;
19 0 print $log $stuff;
20 0 close $log;
21 }
22  
23 1 1;
« Hush/Util.pm ↑ Summary Hush/Memo.pm »