RabbitFoot.pm

filter: Statementstmt 54.1% 26 / 48 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 47.0% 8 / 17 Podpod 0.0% 0 / 5 totaltotal 47.2% 34 / 72 CC 3 SCAR 7.1
CC
3
Cov
52%
_do
6.0
BEGIN
2.1
new
2.0
CRAP 2.0
« RabbitFoot/Channel.pm ↑ Summary RabbitFoot/Cmd/Command/purge_queue.pm »
1 package Net::RabbitFoot;
2  
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 ▶use AnyEvent::RabbitMQ;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Coro;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Coro::AnyEvent;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Net::RabbitFoot::Channel;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our $VERSION = '1.03';
13  
14 1 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.6
15 1 for my $method (qw(connect close)) {
16 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶ *{__PACKAGE__ . '::' . $method} = sub {
Subroutine __ANON__: not called CC=1 SCAR=3.5
18 0 my $self = shift;
19 0 $self->_do($method, @_);
20 0 return $self;
21 2 };
22 }
23 }
24  
25 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
26 0 my $class = shift;
27 0 return bless {
28 _ar => AnyEvent::RabbitMQ->new(@_),
29 }, $class;
30 }
31  
32 0 ▶sub ar {
Subroutine ar: not called CC=1 SCAR=6.9
Pod undocumented
33 0 return shift->{_ar};
34 }
35  
36 0 ▶sub load_xml_spec {
Subroutine load_xml_spec: not called CC=1 SCAR=6.9
Pod undocumented
37 0 my $self = shift;
38 0 $self->{_ar}->load_xml_spec(@_);
39 0 return $self;
40 }
41  
42 0 ▶sub server_properties {
Subroutine server_properties: not called CC=1 SCAR=6.9
Pod undocumented
43 0 return shift->{_ar}->server_properties();
44 }
45  
46 0 ▶sub open_channel {
Subroutine open_channel: not called CC=1 SCAR=6.9
Pod undocumented
47 0 my $self = shift;
48 0 return Net::RabbitFoot::Channel->new(
49 arc => $self->_do('open_channel', @_,)
50 );
51 }
52  
53 0 ▶sub _do {
Subroutine _do: not called CC=2 SCAR=17.9
54 0 my $self = shift;
55 0 my $method = shift;
56 0 my %args = @_;
57  
58 0 my $cb = Coro::rouse_cb;
59 0 ▶ $args{on_success} = sub {$cb->(1, @_);},
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ $args{on_failure} = sub {$cb->(0, @_);},
Subroutine __ANON__: not called CC=1 SCAR=6.9
61  
62 0 $self->{_ar}->$method(%args);
63 0 my ($is_success, @responses) = Coro::rouse_wait;
64 0 ▶ die @responses if !$is_success;
Branch: 1 branch
BranchTrueFalseTotal
unless $is_success 0 0 0
65 0 return @responses;
66 }
67  
68 1 1;
69 __END__
« RabbitFoot/Channel.pm ↑ Summary RabbitFoot/Cmd/Command/purge_queue.pm »