Markdent/Role/FilterHandler.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 93.9% 31 / 33 CC 2 SCAR 2.6
CC
2
Cov
96%
handle_event
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Markdent/CheckedOutput.pm ↑ Summary Markdent/Types/Internal.pm »
1 package Markdent::Role::FilterHandler;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '0.39';
8  
9 1 ▶use Markdent::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 with 'Markdent::Role::Handler';
14  
15 1 requires 'filter_event';
16  
17 1 has handler => (
18 is => 'ro',
19 does => t('HandlerObject'),
20 required => 1,
21 );
22  
23 sub handle_event {
24 14 ▶ my $self = shift;
Subroutine handle_event: called CC=2 SCAR=7.0
Pod undocumented
25 14 my $event = shift;
26  
27 14 my $new_event = $self->filter_event($event);
28  
29 14 ▶ $self->handler->handle_event($new_event)
Branch: 1 branch
BranchTrueFalseTotal
if $new_event 0 14 14
30 if $new_event;
31 }
32  
33 1 1;
34  
35 # ABSTRACT: A role for handlers which act as filters
36  
37 __END__
38  
39 =pod
40  
41 =encoding UTF-8
42  
43 =head1 NAME
44  
45 Markdent::Role::FilterHandler - A role for handlers which act as filters
46  
47 =head1 VERSION
48  
49 version 0.39
50  
51 =head1 DESCRIPTION
52  
53 This role implements behavior and interface for filtering handlers. A filter
54 handler takes events and does something to some of them, and then passes them
55 on to another handler.
56  
57 =head1 REQUIRED METHODS
58  
59 =over 4
60  
61 =item * $handler->filter_event($event)
62  
63 This method will always be called with a single object which does the
64 L<Markdent::Role::Event> role.
65  
66 If this method returns a single event, it will be passed on to the next
67 handler. If it does not return an event, the event is dropped from the stream.
68  
69 =back
70  
71 =head1 ATTRIBUTES
72  
73 This role provides the following attributes:
74  
75 =head2 handler
76  
77 This is a read-only attribute. It is an object which does the
78 L<Markdent::Role::Handler> role.
79  
80 This is the handler to which the filter passes events after filtering.
81  
82 =head1 BUGS
83  
84 See L<Markdent> for bug reporting details.
85  
86 Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>.
87  
88 I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
89  
90 =head1 SOURCE
91  
92 The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>.
93  
94 =head1 AUTHOR
95  
96 Dave Rolsky <autarch@urth.org>
97  
98 =head1 COPYRIGHT AND LICENSE
99  
100 This software is copyright (c) 2021 by Dave Rolsky.
101  
102 This is free software; you can redistribute it and/or modify it under
103 the same terms as the Perl 5 programming language system itself.
104  
105 The full text of the license can be found in the
106 F<LICENSE> file included with this distribution.
107  
108 =cut
« Markdent/CheckedOutput.pm ↑ Summary Markdent/Types/Internal.pm »