File Coverage

blib/lib/Markdent/Handler/CaptureEvents.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Markdent::Handler::CaptureEvents;
2              
3 2     2   34410 use strict;
  2         16  
  2         52  
4 2     2   9 use warnings;
  2         4  
  2         43  
5 2     2   849 use namespace::autoclean;
  2         32367  
  2         8  
6              
7             our $VERSION = '0.38';
8              
9 2     2   918 use Markdent::CapturedEvents;
  2         9  
  2         119  
10 2     2   19 use Specio::Declare;
  2         5  
  2         21  
11              
12 2     2   491 use Moose;
  2         6  
  2         17  
13 2     2   12709 use MooseX::StrictConstructor;
  2         5  
  2         26  
14              
15             with 'Markdent::Role::Handler';
16              
17             has captured_events => (
18             is => 'ro',
19             isa => object_isa_type('Markdent::CapturedEvents'),
20             init_arg => undef,
21             default => sub { Markdent::CapturedEvents->new() },
22             );
23              
24             sub handle_event {
25 264     264 0 8209 $_[0]->captured_events()->capture_events( $_[1] );
26             }
27              
28             __PACKAGE__->meta()->make_immutable();
29              
30             1;
31              
32             # ABSTRACT: Captures events for replaying later
33              
34             __END__
35              
36             =pod
37              
38             =encoding UTF-8
39              
40             =head1 NAME
41              
42             Markdent::Handler::CaptureEvents - Captures events for replaying later
43              
44             =head1 VERSION
45              
46             version 0.38
47              
48             =head1 DESCRIPTION
49              
50             This class implements an event receiver which simply captures events using
51             L<Markdent::CapturedEvents>. This can be used as a way to cache the results of
52             parsing at an intermediate stage.
53              
54             =head1 METHODS
55              
56             This class provides the following methods:
57              
58             =head2 Markdent::Handler::CapturedEvents->new()
59              
60             This method creates a new handler.
61              
62             =head2 $mhce->captured_events()
63              
64             Returns a L<Markdent::CapturedEvents> object containing all the events seen by
65             this handler so far.
66              
67             =head1 ROLES
68              
69             This class does the L<Markdent::Role::Handler> role.
70              
71             =head1 BUGS
72              
73             See L<Markdent> for bug reporting details.
74              
75             Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>.
76              
77             I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
78              
79             =head1 SOURCE
80              
81             The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>.
82              
83             =head1 AUTHOR
84              
85             Dave Rolsky <autarch@urth.org>
86              
87             =head1 COPYRIGHT AND LICENSE
88              
89             This software is copyright (c) 2020 by Dave Rolsky.
90              
91             This is free software; you can redistribute it and/or modify it under
92             the same terms as the Perl 5 programming language system itself.
93              
94             The full text of the license can be found in the
95             F<LICENSE> file included with this distribution.
96              
97             =cut