blib/lib/Kook/Misc.pm

filter: Statementstmt 100% 37 / 37 Branchbran 72.2% 13 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 92.1% 59 / 64 CC 10 SCAR 11.5
CC
10
Cov
91%
_debug
5.0
_report_msg
4.1
_report_cmd
3.1
CRAP 3.1
« blib/lib/Kook/Cookbook.pm ↑ Summary blib/lib/Kook/Sandbox.pm »
1 ###
2 ### $Release: 0.0100 $
3 ### $Copyright: copyright(c) 2009-2011 kuwata-lab.com all rights reserved. $
4 ### $License: MIT License $
5 ###
6  
7 39 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 39 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 package Kook::Misc;
12 39 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 39 our @EXPORT_OK = ('_debug', '_trace', '_report_msg', '_report_cmd');
14 39 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 39 ▶use Kook::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 640 ▶sub _debug {
Subroutine _debug: called CC=5 SCAR=16.1
19 640 my ($msg, $depth, $level) = @_;
20 640 ▶ $level = 1 if ! $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 481 159 640
21 640 ▶ if ($Kook::Config::DEBUG_LEVEL >= $level) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Kook::Config::DEBUG_LEVEL >= $level) 94 546 640
22 94 print $Kook::Config::DEBUG_PROMPT;
23 94 ▶ print '+' x $depth, ' ' if $depth;
Branch: 1 branch
BranchTrueFalseTotal
if $depth 82 12 94
24 94 print $msg;
25 94 ▶ print "\n" unless substr($msg, -1) eq "\n";
Branch: 1 branch
BranchTrueFalseTotal
unless substr($msg, -1) eq "\n" 94 0 94
26 }
27 }
28  
29 159 ▶sub _trace {
Subroutine _trace: called CC=1 SCAR=0.0
30 159 my ($msg, $depth) = @_;
31 159 _debug($msg, $depth, 2);
32 }
33  
34 85 ▶sub _report_msg {
Subroutine _report_msg: called CC=4 SCAR=14.0
35 85 my ($msg, $level) = @_;
36 85 ▶ if ($Kook::Config::VERBOSE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Kook::Config::VERBOSE) 80 5 85
37 80 print $Kook::Config::MESSAGE_PROMPT;
38 80 ▶ print '*' x $level, ' ' if $level;
Branch: 1 branch
BranchTrueFalseTotal
if $level 80 0 80
39 80 print $msg;
40 80 ▶ print "\n" unless substr($msg, -1) eq "\n";
Branch: 1 branch
BranchTrueFalseTotal
unless substr($msg, -1) eq "\n" 80 0 80
41 }
42 }
43  
44 83 ▶sub _report_cmd {
Subroutine _report_cmd: called CC=3 SCAR=11.3
45 83 my ($cmd) = @_;
46 83 ▶ if ($Kook::Config::VERBOSE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Kook::Config::VERBOSE) 83 0 83
47 83 print $Kook::Config::COMMAND_PROMPT;
48 83 print $cmd;
49 83 ▶ print "\n" unless substr($cmd, -1) eq "\n";
Branch: 1 branch
BranchTrueFalseTotal
unless substr($cmd, -1) eq "\n" 83 0 83
50 }
51 }
52  
53  
54 39 1;
« blib/lib/Kook/Cookbook.pm ↑ Summary blib/lib/Kook/Sandbox.pm »