blib/lib/Test/Unit/Debug.pm

filter: Statementstmt 53.8% 14 / 26 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 33.3% 4 / 12 Podpod 50.0% 4 / 8 totaltotal 40.0% 22 / 55 CC 6 SCAR 14.2
CC
6
Cov
42%
debug_to_file
6.0
debug
6.0
debug_pkgs
6.0
CRAP 4.1
« blib/lib/Test/Unit/Exception.pm ↑ Summary blib/lib/Test/Unit/Assertion/Boolean.pm »
1 package Test::Unit::Debug;
2 BEGIN {
3 6 ▶ $Test::Unit::Debug::VERSION = '0.25_1325'; # added by dist-tools/SetVersion.pl
Subroutine BEGIN: called CC=1 SCAR=0.0
4 }
5  
6 =head1 NAME
7  
8 Test::Unit::Debug - framework debugging control
9  
10 =head1 SYNOPSIS
11  
12 package MyRunner;
13  
14 use Test::Unit::Debug qw(debug_to_file debug_pkg);
15  
16 debug_to_file('foo.log');
17 debug_pkg('Test::Unit::TestCase');
18  
19 =cut
20  
21 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 6 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
24 6 ▶use vars qw(@EXPORT_OK);
Subroutine BEGIN: called CC=1 SCAR=0.0
25 6 @EXPORT_OK = qw(debug debug_to_file
26 debug_pkg no_debug_pkg debug_pkgs no_debug_pkgs debugged);
27  
28 6 my %DEBUG = ();
29 6 my $out = \*STDERR;
30  
31 =head1 ROUTINES
32  
33 =head2 debug_to_file($file)
34  
35 Switch debugging to C<$file>.
36  
37 =cut
38  
39 sub debug_to_file {
40 0 ▶ my ($file) = @_;
Subroutine debug_to_file: not called CC=2 SCAR=17.9
Pod documented
41 0 ▶ open(DEBUG, ">$file") or die "Couldn't open $file for writing";
Branch: 1 branch
BranchTrueFalseTotal
open DEBUG, ">$file" or die "Couldn't open $file for writing" 0 0 0
42 0 $out = \*DEBUG;
43 }
44  
45 =head2 debug_to_stderr()
46  
47 Switch debugging to STDERR (this is the default).
48  
49 =cut
50  
51 sub debug_to_stderr {
52 0 ▶ $out = \*STDERR;
Subroutine debug_to_stderr: not called CC=1 SCAR=6.9
Pod documented
53 }
54  
55 sub debug {
56 0 ▶ my ($package, $filename, $line) = caller();
Subroutine debug: not called CC=2 SCAR=17.9
Pod undocumented
57 0 ▶ print $out @_ if $DEBUG{$package};
Branch: 1 branch
BranchTrueFalseTotal
if $DEBUG{$package} 0 0 0
58 }
59  
60 =head2 debug_pkg($pkg)
61  
62 Enable debugging in package C<$pkg>.
63  
64 =cut
65  
66 sub debug_pkg {
67 0 ▶ $DEBUG{$_[0]} = 1;
Subroutine debug_pkg: not called CC=1 SCAR=6.9
Pod documented
68 }
69  
70 =head2 debug_pkgs(@pkgs)
71  
72 Enable debugging in the packages C<@pkgs>.
73  
74 =cut
75  
76 sub debug_pkgs {
77 0 ▶ $DEBUG{$_} = 1 foreach @_;
Subroutine debug_pkgs: not called CC=2 SCAR=17.9
Pod documented
78 }
79  
80 =head2 debug_pkg($pkg)
81  
82 Enable debugging in package C<$pkg>.
83  
84 =cut
85  
86 sub no_debug_pkg {
87 0 ▶ $DEBUG{$_[0]} = 0;
Subroutine no_debug_pkg: not called CC=1 SCAR=6.9
Pod undocumented
88 }
89  
90 =head2 debug_pkgs(@pkgs)
91  
92 Disable debugging in the packages C<@pkgs>.
93  
94 =cut
95  
96 sub no_debug_pkgs {
97 0 ▶ $DEBUG{$_} = 0 foreach @_;
Subroutine no_debug_pkgs: not called CC=2 SCAR=17.9
Pod undocumented
98 }
99  
100 sub debugged {
101 0 ▶ my ($package, $filename, $line) = caller();
Subroutine debugged: not called CC=2 SCAR=17.9
Pod undocumented
102 0 ▶ return $DEBUG{$_[0] || $package};
Condition0%0/3
$_[0] || $package
l!l&&r!l&&!r
000
MC/DC0%0/2
$_[0] || $package
$_[0] $package
Truth table0%0/3
A || B
A= $_[0]B= $package
ABresult
1X1
011
000
103 }
104  
105  
106 =head1 AUTHOR
107  
108 Copyright (c) 2000-2002, 2005 the PerlUnit Development Team
109 (see L<Test::Unit> or the F<AUTHORS> file included in this
110 distribution).
111  
112 All rights reserved. This program is free software; you can
113 redistribute it and/or modify it under the same terms as Perl itself.
114  
115 =head1 SEE ALSO
116  
117 L<Test::Unit>
118  
119 =cut
120  
121 6 1;
« blib/lib/Test/Unit/Exception.pm ↑ Summary blib/lib/Test/Unit/Assertion/Boolean.pm »