line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdent::CapturedEvents; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1481
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
115
|
|
4
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
142
|
|
5
|
4
|
|
|
4
|
|
23
|
use namespace::autoclean; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
23
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.39'; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
1485
|
use Markdent::Types; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
34
|
|
10
|
4
|
|
|
4
|
|
93350
|
use Params::ValidationCompiler qw( validation_for ); |
|
4
|
|
|
|
|
48750
|
|
|
4
|
|
|
|
|
280
|
|
11
|
4
|
|
|
4
|
|
43
|
use Specio::Declare; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
46
|
|
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
2615
|
use Moose; |
|
4
|
|
|
|
|
1305609
|
|
|
4
|
|
|
|
|
33
|
|
14
|
4
|
|
|
4
|
|
28960
|
use MooseX::StrictConstructor; |
|
4
|
|
|
|
|
62502
|
|
|
4
|
|
|
|
|
19
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has _events => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => t( 'ArrayRef', of => t('EventObject') ), |
19
|
|
|
|
|
|
|
init_arg => 'events', |
20
|
|
|
|
|
|
|
default => sub { [] }, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub events { |
24
|
3
|
|
|
3
|
1
|
8
|
@{ $_[0]->_events }; |
|
3
|
|
|
|
|
72
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
my $validator = validation_for( |
29
|
|
|
|
|
|
|
params => [ { type => t('EventObject') } ], |
30
|
|
|
|
|
|
|
slurpy => t('EventObject'), |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub capture_events { |
34
|
264
|
|
|
264
|
1
|
411
|
my $self = shift; |
35
|
264
|
|
|
|
|
3583
|
my @events = $validator->(@_); |
36
|
|
|
|
|
|
|
|
37
|
264
|
|
|
|
|
19951
|
push @{ $self->_events }, @events; |
|
264
|
|
|
|
|
5718
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
my $validator = validation_for( |
43
|
|
|
|
|
|
|
params => [ { type => t('HandlerObject') } ], |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub replay_events { |
47
|
2
|
|
|
2
|
1
|
8
|
my $self = shift; |
48
|
2
|
|
|
|
|
36
|
my ($handler) = $validator->(@_); |
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
|
|
519
|
$handler->handle_event($_) for $self->events; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# ABSTRACT: Represents a series of captured events |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=pod |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=encoding UTF-8 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Markdent::CapturedEvents - Represents a series of captured events |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 VERSION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
version 0.39 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This represents a series of captured parser events, and can be used to replay |
77
|
|
|
|
|
|
|
them with a handle. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 METHODS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This class provides the following methods: |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 Markdent::CapturedEvents->new( events => \@events ); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Creates a new Markdent::CapturedEvents object. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 $captured->events |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Returns the captured events as an array. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 $captured->capture_events(@events) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Captures one or more events. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 $captured->replay_events($handler) |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Given an object which does the L<Markdent::Role::Handler> role, this method |
98
|
|
|
|
|
|
|
will replay all the captured events to that handler. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 BUGS |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
See L<Markdent> for bug reporting details. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SOURCE |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 AUTHOR |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Dave Rolsky. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
121
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
The full text of the license can be found in the |
124
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |