Markdent/Role/AnyParser.pm

filter: Statementstmt 86.8% 33 / 38 Branchbran 33.3% 2 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 83.0% 44 / 53 CC 5 SCAR 13.8
CC
5
Cov
80%
_debug_look_for
10.2
_make_event
2.0
BEGIN
1.0
CRAP 4.0
« Markdent/Parser/SpanParser.pm ↑ Summary Markdent/Role/HTMLStream.pm »
1 package Markdent::Role::AnyParser;
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.41';
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 35 with 'Markdent::Role::DebugPrinter';
14  
15 35 has handler => (
16 is => 'ro',
17 does => t('HandlerObject'),
18 required => 1,
19 );
20  
21 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
22 3334 ▶sub _send_event {
Subroutine _send_event: called CC=1 SCAR=0.0
23 3334 my $self = shift;
24  
25 3334 $self->handler->handle_event( $self->_make_event(@_) );
26 }
27 ## use critic
28  
29 5259 ▶sub _make_event {
Subroutine _make_event: called CC=2 SCAR=7.0
30 5259 my $self = shift;
31 5259 my $class = shift;
32  
33 5259 ▶ my $real_class = $class =~ /::/ ? $class : 'Markdent::Event::' . $class;
Branch: 1 branch
BranchTrueFalseTotal
$class =~ /::/ ? : 0 5259 5259
34  
35 5259 return $real_class->new(@_);
36 }
37  
38 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
39 1628 ▶sub _detab_text {
Subroutine _detab_text: called CC=1 SCAR=0.0
40 1628 my $self = shift;
41 1628 my $text = shift;
42  
43 # Ripped off from Text::Mardkown
44 1628 ${$text} =~ s{ ^
45 (.*?)
46 \t
47 }
48 3 { $1 . (q{ } x (4 - length($1) % 4))}xmge;
49  
50 1628 return;
51 }
52  
53 3320 ▶sub _debug_look_for {
Subroutine _debug_look_for: called CC=4 SCAR=23.2
54 3320 my $self = shift;
55  
56 3320 ▶ return unless $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->debug 3320 0 3320
57  
58 0 ▶ my @look_debug = map { ref $_ ? "$_->[0] ($_->[1])" : $_ } @_;
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 0 0 0
59  
60 0 my $msg = "Looking for the following possible matches:\n";
61 0 $msg .= " - $_\n" for @look_debug;
62  
63 0 $self->_print_debug($msg);
64 }
65 ## use critic
66  
67 35 1;
68  
69 # ABSTRACT: A role for block and span parsers
70  
71 __END__
« Markdent/Parser/SpanParser.pm ↑ Summary Markdent/Role/HTMLStream.pm »