Backend/Role/HasWheel.pm

filter: Statementstmt 92.3% 12 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod n/a totaltotal 88.2% 15 / 17 SCAR 0.0
CC
1
Cov
92%
_build_wheel_id
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Backend.pm ↑ Summary Backend/Connector.pm »
1 package POEx::IRC::Backend::Role::HasWheel;
2 3 $POEx::IRC::Backend::Role::HasWheel::VERSION = '0.030001';
3 3 ▶use Types::Standard -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 has wheel_id => (
8 lazy => 1,
9 isa => Defined,
10 is => 'ro',
11 writer => '_set_wheel_id',
12 0 ▶ builder => sub { shift->wheel->ID },
Subroutine _build_wheel_id: not called CC=1 SCAR=6.9
13 3 );
14  
15 has wheel => (
16 required => 1,
17 isa => Maybe[ InstanceOf['POE::Wheel'] ],
18 is => 'ro',
19 clearer => 'clear_wheel',
20 writer => 'set_wheel',
21 predicate => 'has_wheel',
22 trigger => sub {
23 4 ▶ my ($self, $wheel) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
24 4 $self->_set_wheel_id( $wheel->ID )
25 },
26 3 );
27  
28 3 1;
29  
30 =pod
31  
32 =for Pod::Coverage has_\w+
33  
34 =head1 NAME
35  
36 POEx::IRC::Backend::Role::HasWheel
37  
38 =head1 SYNOPSIS
39  
40 A L<Moo::Role> for classes that have associated POE::Wheel instances.
41  
42 =head1 DESCRIPTION
43  
44 =head2 wheel
45  
46 A L<POE::Wheel> instance (typically L<POE::Wheel::SocketFactory> for listeners
47 and connectors or L<POE::Wheel::ReadWrite> for live connections).
48  
49 This is primarily for internal use. External code should not interact directly
50 with the C<wheel>.
51  
52 Can be cleared via B<clear_wheel>; use B<has_wheel> to determine if this
53 listener's wheel has been cleared.
54  
55 Can be replaced via B<set_wheel> (although whether this is a good idea or not
56 is debatable; better to spawn a new instance of your class)
57  
58 =head2 wheel_id
59  
60 The POE ID of the last known L</wheel>.
61  
62 =head1 AUTHOR
63  
64 Jon Portnoy <avenj@cobaltirc.org>
65  
66 =cut
« Backend.pm ↑ Summary Backend/Connector.pm »