Queue.pm

filter: Statementstmt 21.6% 8 / 37 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 12.5% 1 / 8 Podpod 0.0% 0 / 7 totaltotal 13.2% 9 / 68 CC 6 SCAR 19.7
CC
6
Cov
16%
bind
12.0
unbind
12.0
new
6.0
CRAP 7.2
« Connection.pm ↑ Summary
1 package Net::RabbitMQ::Queue;
2  
3 1 ▶use Class::Easy;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 has 'connection';
6 1 has 'channel';
7 1 has 'exchange';
8 1 has 'name';
9  
10 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
11 0 my $class = shift;
12 0 my $channel = shift;
13 0 my $name = shift;
14 0 my $options = {@_};
15
16 0 ▶ if ($channel->_do (
Branch: 1 branch
BranchTrueFalseTotal
if ($channel->_do("queue_declare", $name, {"exchange_type", "topic", "passive", 0, "durable", 1, "auto_delete", 0, %$options})) 0 0 0
17 'queue_declare', $name, {
18 exchange_type => "topic",
19 passive => 0, # the exchange will not get declared but an error will be thrown if it does not exist.
20 durable => 1, # the exchange will survive a broker restart.
21 auto_delete => 0, # the exchange will get deleted as soon as there are no more queues bound to it. Exchanges to which queues have never been bound will never get auto deleted.
22 %$options
23 }
24 )) {
25 0 return bless {
26 name => $name,
27 channel => $channel
28 }, $class;
29 }
30
31 # if channel didn't open, then we died before this string
32 }
33  
34 0 ▶sub bind {
Subroutine bind: not called CC=3 SCAR=24.8
Pod undocumented
35 0 my $self = shift;
36 0 my $xchange = shift;
37 0 my $routing_key = shift;
38  
39 0 ▶ my $xchange_name = (ref ($xchange) and $xchange->can ('name')) ? $xchange->name : $xchange;
Branch: 1 branch
BranchTrueFalseTotal
ref $xchange && $xchange->can('name') ? : 0 0 0
Condition0%0/3
ref $xchange and $xchange->can("name")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $xchange and $xchange->can("name")
ref $xchange $xchange->can("name")
Truth table0%0/3
A and B
A= ref $xchangeB= $xchange->can("name")
ABresult
0X0
100
111
40  
41 0 $self->channel->_do ('queue_bind', $self->name, $xchange_name, $routing_key);
42 }
43  
44 0 ▶sub unbind {
Subroutine unbind: not called CC=3 SCAR=24.8
Pod undocumented
45 0 my $self = shift;
46 0 my $xchange = shift;
47 0 my $routing_key = shift;
48
49 0 ▶ my $xchange_name = (ref ($xchange) and $xchange->can ('name')) ? $xchange->name : $xchange;
Branch: 1 branch
BranchTrueFalseTotal
ref $xchange && $xchange->can('name') ? : 0 0 0
Condition0%0/3
ref $xchange and $xchange->can("name")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $xchange and $xchange->can("name")
ref $xchange $xchange->can("name")
Truth table0%0/3
A and B
A= ref $xchangeB= $xchange->can("name")
ABresult
0X0
100
111
50
51 0 $self->channel->_do ('queue_unbind', $self->name, $xchange_name, $routing_key);
52 }
53  
54  
55 0 ▶sub get {
Subroutine get: not called CC=1 SCAR=6.9
Pod undocumented
56 0 my $self = shift;
57 0 my $opts = {@_};
58
59 0 my ($success, $result) = $self->channel->_do ('get', $self->name, $opts);
60
61 0 return $result;
62 }
63  
64 0 ▶sub consume {
Subroutine consume: not called CC=1 SCAR=6.9
Pod undocumented
65 0 my $self = shift;
66 0 my $opts = {@_};
67
68 0 my ($success, $result) = $self->channel->_do ('consume', $self->name, $opts);
69 }
70  
71 0 ▶sub recv {
Subroutine recv: not called CC=1 SCAR=6.9
Pod undocumented
72 0 my $self = shift;
73 #my $opts = {@_};
74
75 0 my ($success, $result) = $self->channel->_do ('recv');
76
77 0 return $result;
78 }
79  
80 0 ▶sub purge {
Subroutine purge: not called CC=1 SCAR=6.9
Pod undocumented
81 0 my $self = shift;
82 0 my $no_wait = $_[0];
83
84 0 my ($success, $result) = $self->channel->_do ('purge', $self->name, @_);
85 }
86  
87 1 1;
« Connection.pm ↑ Summary