| 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')
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')
| |||||||||||||||||||||
| 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')
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')
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 17 | 0 | my $stuff = "[$time] [$$] $msg\n"; | |||||||||||||||||||
| 18 | #print $stuff; | ||||||||||||||||||||
| 19 | 0 | print $log $stuff; | |||||||||||||||||||
| 20 | 0 | close $log; | |||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | 1; | |||||||||||||||||||