line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdent::Role::DebugPrinter; |
2
|
|
|
|
|
|
|
|
3
|
35
|
|
|
35
|
|
25009
|
use strict; |
|
35
|
|
|
|
|
83
|
|
|
35
|
|
|
|
|
1187
|
|
4
|
35
|
|
|
35
|
|
214
|
use warnings; |
|
35
|
|
|
|
|
97
|
|
|
35
|
|
|
|
|
1081
|
|
5
|
35
|
|
|
35
|
|
214
|
use namespace::autoclean; |
|
35
|
|
|
|
|
70
|
|
|
35
|
|
|
|
|
264
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.40'; |
8
|
|
|
|
|
|
|
|
9
|
35
|
|
|
35
|
|
2989
|
use Markdent::Types; |
|
35
|
|
|
|
|
75
|
|
|
35
|
|
|
|
|
240
|
|
10
|
|
|
|
|
|
|
|
11
|
35
|
|
|
35
|
|
903253
|
use Moose::Role; |
|
35
|
|
|
|
|
92
|
|
|
35
|
|
|
|
|
406
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has debug => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
isa => t('Bool'), |
16
|
|
|
|
|
|
|
default => $ENV{MARKDENT_DEBUG} || 0, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $HR1 = q{=} x 70; |
20
|
|
|
|
|
|
|
my $HR2 = q{-} x 70; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
23
|
|
|
|
|
|
|
sub _debug_parse_result { |
24
|
0
|
|
|
0
|
|
|
my $self = shift; |
25
|
0
|
|
|
|
|
|
my $text = shift; |
26
|
0
|
|
|
|
|
|
my $type = shift; |
27
|
0
|
|
0
|
|
|
|
my $extra = shift || []; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $msg = '[' . $text . "]\n" . $HR2 . "\n" . ' - ' . $type . "\n"; |
30
|
0
|
|
|
|
|
|
while ( @{$extra} ) { |
|
0
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my ( $key, $value ) = splice @{$extra}, 0, 2; |
|
0
|
|
|
|
|
|
|
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
|
|
|
0
|
|
|
warn $HR1 . "\n" . ( ref $_[0] ) . "\n" . $_[1] . "\n"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
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.40 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRIPTION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This role implements behavior shared by all classes which output debugging |
65
|
|
|
|
|
|
|
information. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This roles provides the following attributes: |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 debug |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This is a read-write boolean attribute. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
It defaults to the value of C<$ENV{MARKDENT_DEBUG}>, if set, or 0. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 METHODS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This roles provides the following methods: |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 $object->_debug_parse_result( $text, $type, $extra ) |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This method takes a text string, a parse result string (like "preformatted" or |
84
|
|
|
|
|
|
|
"code_start"), and an optional array reference of extra key/value pairs. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
All of this will be concatenated together in a pretty(-ish) way and passed to |
87
|
|
|
|
|
|
|
C<< $object->_print_debug >>. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 $object->_print_debug($text) |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This warns out the provided text along with a delimiter above the message. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 BUGS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
See L<Markdent> for bug reporting details. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SOURCE |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Dave Rolsky. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
114
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The full text of the license can be found in the |
117
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |