File Coverage

blib/lib/Markdent/Handler/Multiplexer.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 27 28 96.4


line stmt bran cond sub pod time code
1             package Markdent::Handler::Multiplexer;
2              
3 1     1   586 use strict;
  1         2  
  1         37  
4 1     1   6 use warnings;
  1         2  
  1         34  
5 1     1   5 use namespace::autoclean;
  1         3  
  1         9  
6              
7             our $VERSION = '0.40';
8              
9 1     1   94 use Markdent::Types;
  1         2  
  1         9  
10              
11 1     1   27123 use Moose;
  1         3  
  1         9  
12 1     1   7335 use MooseX::StrictConstructor;
  1         2  
  1         10  
13              
14             with 'Markdent::Role::Handler';
15              
16             has _handlers => (
17             is => 'ro',
18             isa => t( 'ArrayRef', of => t('HandlerObject') ),
19             init_arg => 'handlers',
20             required => 1,
21             );
22              
23             sub handle_event {
24 264     264 0 468 $_->handle_event( $_[1] ) for @{ $_[0]->_handlers };
  264         7545  
25             }
26              
27             __PACKAGE__->meta->make_immutable;
28              
29             1;
30              
31             # ABSTRACT: Passes events on to multiple handlers
32              
33             __END__
34              
35             =pod
36              
37             =encoding UTF-8
38              
39             =head1 NAME
40              
41             Markdent::Handler::Multiplexer - Passes events on to multiple handlers
42              
43             =head1 VERSION
44              
45             version 0.40
46              
47             =head1 DESCRIPTION
48              
49             This class passes the event stream onto one or more handlers. This is handy if
50             you want to do multiple things with a document at once, for example generate
51             HTML and capture the events to save for a cache.
52              
53             =head1 METHODS
54              
55             This class provides the following methods:
56              
57             =head2 Markdent::Handler::Multiplexer->new( handlers => [ ... ] )
58              
59             This method creates a new handler. You must pass a list of one or more objects
60             which do the L<Markdent::Role::Handler> role as the "handlers" parameters.
61              
62             =head1 ROLES
63              
64             This class does the L<Markdent::Role::Handler> role.
65              
66             =head1 BUGS
67              
68             See L<Markdent> for bug reporting details.
69              
70             Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>.
71              
72             I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
73              
74             =head1 SOURCE
75              
76             The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>.
77              
78             =head1 AUTHOR
79              
80             Dave Rolsky <autarch@urth.org>
81              
82             =head1 COPYRIGHT AND LICENSE
83              
84             This software is copyright (c) 2021 by Dave Rolsky.
85              
86             This is free software; you can redistribute it and/or modify it under
87             the same terms as the Perl 5 programming language system itself.
88              
89             The full text of the license can be found in the
90             F<LICENSE> file included with this distribution.
91              
92             =cut