Markdent/Role/DebugPrinter.pm

filter: Statementstmt 60.6% 20 / 33 Branchbran 0.0% 0 / 2 Conditioncond 25.0% 1 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 71.4% 5 / 7 Podpod n/a totaltotal 54.1% 26 / 48 CC 3 SCAR 15.6
CC
3
Cov
54%
_debug_parse_result
12.0
_print_debug
2.0
BEGIN
1.0
CRAP 4.8
« Markdent/Parser/BlockParser.pm ↑ Summary Markdent/Parser.pm »
1 package Markdent::Role::DebugPrinter;
2  
3 35 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 35 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 35 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 35 our $VERSION = '0.39';
8  
9 35 ▶use Markdent::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 35 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 has debug => (
14 is => 'rw',
15 isa => t('Bool'),
16 35 ▶ default => $ENV{MARKDENT_DEBUG} || 0,
Condition50%1/2
$ENV{'MARKDENT_DEBUG'} || 0
l!l
035
MC/DC0%0/1
$ENV{'MARKDENT_DEBUG'} || 0
$ENV{'MARKDENT_DEBUG'}
Truth table50%1/2
A
A= $ENV{'MARKDENT_DEBUG'}
Aresult
11
00
17 );
18  
19 35 my $HR1 = q{=} x 70;
20 35 my $HR2 = q{-} x 70;
21  
22 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
23 sub _debug_parse_result {
24 0 ▶ my $self = shift;
Subroutine _debug_parse_result: not called CC=3 SCAR=24.8
25 0 my $text = shift;
26 0 my $type = shift;
27 0 ▶ my $extra = shift || [];
Condition0%0/2
shift() || []
l!l
00
MC/DC0%0/1
shift() || []
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
28  
29 0 my $msg = '[' . $text . "]\n" . $HR2 . "\n" . ' - ' . $type . "\n";
30 0 ▶ while ( @{$extra} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$extra;}) 0 0 0
31 0 my ( $key, $value ) = splice @{$extra}, 0, 2;
32 0 $msg .= sprintf( ' - %-10s : %s', $key, $value );
33 0 $msg .= "\n";
34 }
35  
36 0 $self->_print_debug($msg);
37 }
38 ## use critic
39  
40 sub _print_debug {
41 0 ▶ warn $HR1 . "\n" . ( ref $_[0] ) . "\n" . $_[1] . "\n";
Subroutine _print_debug: not called CC=1 SCAR=6.9
42 }
43  
44 35 1;
45  
46 # ABSTRACT: A role for classes which output debugging information
47  
48 __END__
49  
50 =pod
51  
52 =encoding UTF-8
53  
54 =head1 NAME
55  
56 Markdent::Role::DebugPrinter - A role for classes which output debugging information
57  
58 =head1 VERSION
59  
60 version 0.39
61  
62 =head1 DESCRIPTION
63  
64 This role implements behavior shared by all classes which output debugging information.
65  
66 =head1 ATTRIBUTES
67  
68 This roles provides the following attributes:
69  
70 =head2 debug
71  
72 This is a read-write boolean attribute.
73  
74 It defaults to the value of C<$ENV{MARKDENT_DEBUG}>, if set, or 0.
75  
76 =head1 METHODS
77  
78 This roles provides the following methods:
79  
80 =head2 $object->_debug_parse_result( $text, $type, $extra )
81  
82 This method takes a text string, a parse result string (like "preformatted" or
83 "code_start"), and an optional array reference of extra key/value pairs.
84  
85 All of this will be concatenated together in a pretty(-ish) way and passed to
86 C<< $object->_print_debug >>.
87  
88 =head2 $object->_print_debug($text)
89  
90 This warns out the provided text along with a delimiter above the message.
91  
92 =head1 BUGS
93  
94 See L<Markdent> for bug reporting details.
95  
96 Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>.
97  
98 I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
99  
100 =head1 SOURCE
101  
102 The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>.
103  
104 =head1 AUTHOR
105  
106 Dave Rolsky <autarch@urth.org>
107  
108 =head1 COPYRIGHT AND LICENSE
109  
110 This software is copyright (c) 2021 by Dave Rolsky.
111  
112 This is free software; you can redistribute it and/or modify it under
113 the same terms as the Perl 5 programming language system itself.
114  
115 The full text of the license can be found in the
116 F<LICENSE> file included with this distribution.
117  
118 =cut
« Markdent/Parser/BlockParser.pm ↑ Summary Markdent/Parser.pm »