| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bot::Backbone::Dispatcher::PredicateIterator; |
|
2
|
|
|
|
|
|
|
$Bot::Backbone::Dispatcher::PredicateIterator::VERSION = '0.160630'; |
|
3
|
4
|
|
|
4
|
|
35
|
use v5.10; |
|
|
4
|
|
|
|
|
11
|
|
|
4
|
4
|
|
|
4
|
|
14
|
use Moose; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
16309
|
use Bot::Backbone::Types qw( PredicateList ); |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
25
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has dispatcher => ( |
|
12
|
|
|
|
|
|
|
is => 'ro', |
|
13
|
|
|
|
|
|
|
isa => 'Bot::Backbone::Dispatcher', |
|
14
|
|
|
|
|
|
|
required => 1, |
|
15
|
|
|
|
|
|
|
); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has predicate_list => ( |
|
18
|
|
|
|
|
|
|
is => 'rw', |
|
19
|
|
|
|
|
|
|
isa => PredicateList, |
|
20
|
|
|
|
|
|
|
required => 1, |
|
21
|
|
|
|
|
|
|
default => sub { [] }, |
|
22
|
|
|
|
|
|
|
traits => [ 'Array' ], |
|
23
|
|
|
|
|
|
|
handles => { |
|
24
|
|
|
|
|
|
|
have_more_predicates => 'count', |
|
25
|
|
|
|
|
|
|
next_from_predicate_list => 'shift', |
|
26
|
|
|
|
|
|
|
add_predicates => 'push', |
|
27
|
|
|
|
|
|
|
}, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub BUILD { |
|
32
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
33
|
1
|
|
|
|
|
4
|
$self->reset; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub next_predicate { |
|
38
|
5
|
|
|
5
|
1
|
6
|
my $self = shift; |
|
39
|
|
|
|
|
|
|
|
|
40
|
5
|
100
|
|
|
|
184
|
return unless $self->have_more_predicates; |
|
41
|
|
|
|
|
|
|
|
|
42
|
4
|
|
|
|
|
144
|
my $predicate = $self->next_from_predicate_list; |
|
43
|
4
|
|
|
|
|
14
|
$self->add_predicates($predicate->more_predicates); |
|
44
|
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
12
|
return $predicate; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub reset { |
|
50
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
|
51
|
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
31
|
$self->predicate_list([ |
|
53
|
|
|
|
|
|
|
$self->dispatcher->list_predicates, |
|
54
|
|
|
|
|
|
|
$self->dispatcher->list_also_predicates, |
|
55
|
|
|
|
|
|
|
]); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=pod |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=encoding UTF-8 |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Bot::Backbone::Dispatcher::PredicateIterator - Iterator over the predicates in a dispatcher |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 VERSION |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
version 0.160630 |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $iterator = $dispatcher->predicate_iterator; |
|
77
|
|
|
|
|
|
|
while (my $predicate = $iterator->next_predicate) { |
|
78
|
|
|
|
|
|
|
# do something... |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This is a helper for iterating over predicates in a L<Bot::Backbone::Dispatcher>. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 dispatcher |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This is the dispatcher this iterator iterates over. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 METHODS |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 BUILD |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Resets the iterator to the start at construction. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 next_predicate |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Returns the next L<Bot::Backbone::Dispatcher::Predicate> or C<undef> if all predicates have been iterated through. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 reset |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Starts over by retriving the list of predicates that belong to the associated L<Bot::Backbone::Dispatcher>. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Andrew Sterling Hanenkamp <hanenkamp@cpan.org> |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Qubling Software LLC. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
114
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
|
117
|
|
|
|
|
|
|
|