line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdent::Role::DebugPrinter; |
2
|
|
|
|
|
|
|
|
3
|
34
|
|
|
34
|
|
22493
|
use strict; |
|
34
|
|
|
|
|
88
|
|
|
34
|
|
|
|
|
1174
|
|
4
|
34
|
|
|
34
|
|
269
|
use warnings; |
|
34
|
|
|
|
|
86
|
|
|
34
|
|
|
|
|
954
|
|
5
|
34
|
|
|
34
|
|
200
|
use namespace::autoclean; |
|
34
|
|
|
|
|
78
|
|
|
34
|
|
|
|
|
237
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.38'; |
8
|
|
|
|
|
|
|
|
9
|
34
|
|
|
34
|
|
2786
|
use Markdent::Types; |
|
34
|
|
|
|
|
81
|
|
|
34
|
|
|
|
|
240
|
|
10
|
|
|
|
|
|
|
|
11
|
34
|
|
|
34
|
|
855604
|
use Moose::Role; |
|
34
|
|
|
|
|
123
|
|
|
34
|
|
|
|
|
387
|
|
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.38 |
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) 2020 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 |