lib/Horris/Connection/Plugin.pm

filter: Statementstmt 73.0% 19 / 26 Branchbran 12.5% 1 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 58.9% 23 / 39 CC 5 SCAR 18.3
CC
5
Cov
59%
init
12.0
__ANON__
3.9
BEGIN
1.0
CRAP 6.2
« blib/lib/App/Horris/CLI/Command/feed.pm ↑ Summary blib/lib/App/Horris/CLI/Command/twitter_stream.pm »
1 package Horris::Connection::Plugin;
2 # ABSTRACT: Base Package of Plugins
3  
4  
5 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use namespace::clean -except => qw/meta/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 has connection => (
9 is => 'ro',
10 isa => 'Horris::Connection',
11 writer => '_connection'
12 );
13  
14 4 has is_enable => (
15 traits => ['Bool'],
16 is => 'rw',
17 isa => 'Bool',
18 default => 1,
19 handles => {
20 enable => 'set',
21 disable => 'unset',
22 _switch => 'toggle',
23 is_disable => 'not'
24 }
25 );
26  
27 4 has pass => (
28 is => 'ro',
29 isa => 'Int',
30 default => 0,
31 );
32  
33 4 has done => (
34 is => 'ro',
35 isa => 'Int',
36 default => 1,
37 );
38  
39 0 ▶sub init {
Subroutine init: not called CC=3 SCAR=24.8
Pod undocumented
40 0 my ($self, $conn) = @_;
41 0 my $pname = ref $self;
42 0 ▶ print $pname, " on - ", $self->is_enable ? 'enable' : 'disable', "\n" if $Horris::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $Horris::DEBUG 0 0 0
$self->is_enable ? : 0 0 0
43 0 $self->_connection($conn);
44 }
45  
46 4 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=13.6
47 4 my ($orig, $class, @args) = @_;
48 4 my $self = $class->$orig(@args);
49 4 my @reserve_keys = qw/parent name/;
50 4 ▶ while (my ($key, $value) = each %{ $self->{parent}{plugin}{$self->{name}} }) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$self->{"parent"}{"plugin"}{$self->{"name"}};}) 0 4 4
51 0 ▶ confess 'keys [' . join(', ', @reserve_keys) . "] are reserved\n" if grep { $key eq $_ } @reserve_keys;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$key eq $_;} @reserve_keys 0 0 0
52 0 $self->{$key} = $value;
53 }
54  
55 4 return $self;
56 4 };
57  
58 4 __PACKAGE__->meta->make_immutable;
59  
60 4 1;
61  
62 __END__
« blib/lib/App/Horris/CLI/Command/feed.pm ↑ Summary blib/lib/App/Horris/CLI/Command/twitter_stream.pm »