Listener.pm

filter: Statementstmt 100% 15 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 19 / 19 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Event.pm ↑ Summary
1 package Beam::Listener;
2 10 our $VERSION = '1.007';
3  
4 #pod =head1 SYNOPSIS
5 #pod
6 #pod package MyListener;
7 #pod
8 #pod extends 'Beam::Listener';
9 #pod
10 #pod
11 #pod # add metadata with subscription time
12 #pod has sub_time => is ( 'ro',
13 #pod init_arg => undef,
14 #pod default => sub { time() },
15 #pod );
16 #pod
17 #pod # My::Emitter consumes the Beam::Emitter role
18 #pod my $emitter = My::Emitter->new;
19 #pod $emitter->on( "foo", sub {
20 #pod my ( $event ) = @_;
21 #pod print "Foo happened!\n";
22 #pod # stop this event from continuing
23 #pod $event->stop;
24 #pod },
25 #pod class => MyListener
26 #pod );
27 #pod
28 #pod
29 #pod =head1 DESCRIPTION
30 #pod
31 #pod This is the base class used by C<Beam::Emitter> objects to store information
32 #pod about listeners. Create a subclass to add data attributes.
33 #pod
34 #pod =head1 SEE ALSO
35 #pod
36 #pod =over 4
37 #pod
38 #pod =item L<Beam::Emitter>
39 #pod
40 #pod =back
41 #pod
42 #pod =cut
43  
44 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 10 ▶use Types::Standard qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
48 10 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 #pod =attr code
51 #pod
52 #pod A coderef which will be invoked when the event is distributed.
53 #pod
54 #pod =cut
55  
56 10 has callback => (
57 is => 'ro',
58 isa => CodeRef,
59 required => 1,
60 );
61  
62 10 1;
63  
64 __END__
« Event.pm ↑ Summary