blib/lib/Cikl/Redis.pm

filter: Statementstmt 70.8% 34 / 48 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 69.2% 9 / 13 Podpod 0.0% 0 / 1 totaltotal 67.1% 43 / 64 CC 2 SCAR 6.6
CC
2
Cov
68%
shutdown_conn
6.0
_build_conn
2.0
__ANON__
2.0
CRAP 1.9
↑ Summary
1 package Cikl::Redis;
2 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = "0.01";
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Redis;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Cikl::Client::Transport;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 with 'Cikl::Client::Transport';
14 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 has 'server' => (
17 is => 'ro',
18 isa => 'Str',
19 default => 'localhost:6379'
20 );
21  
22 1 has 'list' => (
23 is => 'ro',
24 isa => 'Str',
25 default => 'cikl.event'
26 );
27  
28 1 has 'conn' => (
29 is => 'ro',
30 isa => 'Redis',
31 init_arg => undef,
32 lazy_build => 1
33 );
34  
35 0 ▶sub _build_conn {
Subroutine _build_conn: not called CC=1 SCAR=6.9
36 0 my $self = shift;
37 0 return Redis->new(
38 server => $self->server()
39 );
40 }
41  
42 0 ▶sub shutdown_conn {
Subroutine shutdown_conn: not called CC=2 SCAR=17.9
Pod undocumented
43 0 my $self = shift;
44  
45 0 ▶ if ($self->has_conn()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_conn) 0 0 0
46 0 $self->conn->quit();
47 0 $self->clear_conn();
48 }
49 }
50  
51 0 ▶after 'shutdown' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
52 0 my $self = shift;
53  
54 0 $self->shutdown_conn();
55  
56 0 return 1;
57 1 };
58  
59 0 ▶sub _submit {
Subroutine _submit: not called CC=1 SCAR=6.9
60 0 my $self = shift;
61 0 my $event = shift;
62  
63 0 my $body = $self->encode_event($event);
64 0 $self->conn->rpush(
65 $self->list(),
66 $body
67 );
68 0 return undef;
69 }
70 1 __PACKAGE__->meta->make_immutable();
71 1 1;
72  
73 __END__
↑ Summary