| 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
| |||||||||||
| 21 | 640 | ▶ | if ($Kook::Config::DEBUG_LEVEL >= $level) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 94 | print $Kook::Config::DEBUG_PROMPT; | |||||||||
| 23 | 94 | ▶ | print '+' x $depth, ' ' if $depth; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 94 | print $msg; | |||||||||
| 25 | 94 | ▶ | print "\n" unless substr($msg, -1) eq "\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 37 | 80 | print $Kook::Config::MESSAGE_PROMPT; | |||||||||
| 38 | 80 | ▶ | print '*' x $level, ' ' if $level; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 80 | print $msg; | |||||||||
| 40 | 80 | ▶ | print "\n" unless substr($msg, -1) eq "\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 47 | 83 | print $Kook::Config::COMMAND_PROMPT; | |||||||||
| 48 | 83 | print $cmd; | |||||||||
| 49 | 83 | ▶ | print "\n" unless substr($cmd, -1) eq "\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | } | ||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | 39 | 1; | |||||||||