Contract/Debug.pm

filter: Statementstmt 82.6% 19 / 23 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 83.8% 26 / 31 CC 2 SCAR 5.1
CC
2
Cov
80%
debug
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Contract/Pool.pm ↑ Summary Contract/ArgumentChecks.pm »
1 #
2 # Sub::Contract::Debug - Guess once...
3 #
4 # $Id: Debug.pm,v 1.11 2009/06/16 12:23:58 erwan_lemonnier Exp $
5 #
6  
7 package Sub::Contract::Debug;
8  
9 23 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 23 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 23 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 23 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 23 our $VERSION = '0.12';
16  
17 23 our @EXPORT = ();
18 23 our @EXPORT_OK = ('debug');
19  
20 # to turn on debugging output in Sub::Contract, just
21 # set $DEBUG to more than 0:
22  
23 23 my $DEBUG = 0;
24  
25 #---------------------------------------------------------------
26 #
27 # debug - print a debug message to stdout
28 #
29  
30 127 ▶sub debug {
Subroutine debug: called CC=2 SCAR=10.9
Pod documented
31 127 my ($level,$text) = @_;
32  
33 127 ▶ if ($level <= $DEBUG) {
Branch: 1 branch
BranchTrueFalseTotal
if ($level <= $DEBUG) 0 127 127
34 0 chomp $text;
35 0 my (undef, undef, $line) = caller(0);
36 0 my (undef, undef, undef, $func) = caller(1);
37 0 print "# DEBUG $func, l.".sprintf("%- 5s","$line:")." $text\n";
38 }
39 }
40  
41 23 1;
42  
43 __END__
« Contract/Pool.pm ↑ Summary Contract/ArgumentChecks.pm »