File Coverage

blib/lib/Eve/Event.pm
Criterion Covered Total %
statement 9 19 47.3
branch n/a
condition n/a
subroutine 3 5 60.0
pod 2 2 100.0
total 14 26 53.8


line stmt bran cond sub pod time code
1             package Eve::Event;
2              
3 8     8   3821 use parent qw(Eve::Class);
  8         18  
  8         49  
4              
5 8     8   436 use strict;
  8         15  
  8         206  
6 8     8   40 use warnings;
  8         13  
  8         1287  
7              
8             =head1 NAME
9              
10             B - a base class for all event classes.
11              
12             =head1 SYNOPSIS
13              
14             package Eve::Event::Foo;
15              
16             use parent qw(Eve::Event);
17              
18             1;
19              
20             my $event = Eve::Event::Foo->new(event_map => $event_map)
21             ->trigger();
22              
23             =head1 DESCRIPTION
24              
25             B is an abstract class that must be inherited
26             by event classes. This will enable them to be triggered and have
27             handlers bound to them.
28              
29             =head3 Constructor arguments:
30              
31             =over 4
32              
33             =item C
34              
35             an event map the event will interact with.
36              
37             =back
38              
39             =head1 METHODS
40              
41             =head2 B
42              
43             =cut
44              
45             sub init {
46 0     0 1   my ($self, %arg_hash) = @_;
47 0           Eve::Support::arguments(\%arg_hash, my $event_map);
48              
49 0           $self->{'_event_map'} = $event_map;
50              
51 0           return;
52             }
53              
54             =head2 B
55              
56             The C method is used to start processing the event by all
57             handlers that are bound to it and its ancestors.
58              
59             =cut
60              
61             sub trigger {
62 0     0 1   my $self = shift;
63              
64 0           my $handler_list = $self->_event_map->get_handler_list(event => $self);
65 0           for my $handler (@{$handler_list}) {
  0            
66 0           $handler->handle(event => $self);
67             }
68              
69 0           return;
70             }
71              
72             =head1 SEE ALSO
73              
74             =over 4
75              
76             =item L
77              
78             =item L
79              
80             =back
81              
82             =head1 LICENSE AND COPYRIGHT
83              
84             Copyright 2012 Igor Zinovyev.
85              
86             This program is free software; you can redistribute it and/or modify it
87             under the terms of either: the GNU General Public License as published
88             by the Free Software Foundation; or the Artistic License.
89              
90             See http://dev.perl.org/licenses/ for more information.
91              
92              
93             =head1 AUTHOR
94              
95             =over 4
96              
97             =item L
98              
99             =back
100              
101             =cut
102              
103             1;