| 1 | package AnyEvent::RabbitMQ::PubSub; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
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 | 1 | ▶ | use AnyEvent; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use AnyEvent::RabbitMQ; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Carp qw(longmess); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | our $VERSION = "3.2.1"; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub connect { | ||||||||||||||||||||||||||
|
Subroutine
connect: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 0 | my %connection_opts = @_; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | my $cv = AnyEvent->condvar; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | my $ar = AnyEvent::RabbitMQ->new->load_xml_spec()->connect( | ||||||||||||||||||||||||||||
| 18 | %connection_opts, | ||||||||||||||||||||||||||||
| 19 | 0 | ▶ | on_success => sub { _open_channel_given_condvar($cv, @_) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | on_failure => sub { _report_error($cv, @_) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | on_read_failure => sub { _report_error($cv, @_) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | on_return => sub { _report_error($cv, @_) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | on_close => sub { _report_error($cv, @_) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 24 | 0 | ); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | return $cv->recv() | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub open_channel { | ||||||||||||||||||||||||||
|
Subroutine
open_channel: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 0 | my ($ar) = @_; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | my $cv = AnyEvent->condvar; | |||||||||||||||||||||||||||
| 33 | 0 | _open_channel_given_condvar($cv, $ar); | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | (undef, my $channel) = $cv->recv(); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | return $channel | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub _open_channel_given_condvar { | ||||||||||||||||||||||||||
|
Subroutine
_open_channel_given_condvar: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 41 | 0 | my ($cv, $ar) = @_; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | $ar->open_channel( | ||||||||||||||||||||||||||||
| 44 | 0 | ▶ | on_success => sub { my $channel = shift; $cv->send($ar, $channel); }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | on_failure => sub { _report_error($cv, @_) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | on_close => sub { _report_error($cv, @_) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 47 | ) | ||||||||||||||||||||||||||||
| 48 | 0 | } | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub _report_error { | ||||||||||||||||||||||||||
|
Subroutine
_report_error: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 51 | 0 | my ($cv, $why) = @_; | |||||||||||||||||||||||||||
| 52 | 0 | ▶ | if (ref($why) && $why->can('method_frame')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $why and $why->can("method_frame")
MC/DC0%0/2
ref $why and $why->can("method_frame")
ref $why
$why->can("method_frame")
Truth table0%0/3
A and B
A= ref $whyB= $why->can("method_frame")
| |||||||||||||||||||||||||||||
| 53 | 0 | my $method_frame = $why->method_frame; | |||||||||||||||||||||||||||
| 54 | 0 | ▶ | $cv->croak(longmess( | ||||||||||||||||||||||||||
|
Condition0%0/4
$method_frame->reply_code || 503
$method_frame->reply_text || 'Something went wrong.'
MC/DC0%0/1
$method_frame->reply_code || 503
$method_frame->reply_code
MC/DC0%0/1
$method_frame->reply_text || 'Something went wrong.'
$method_frame->reply_text
Truth table0%0/2
A
A= $method_frame->reply_code
Truth table0%0/2
A
A= $method_frame->reply_text
| |||||||||||||||||||||||||||||
| 55 | sprintf '%s: %s', | ||||||||||||||||||||||||||||
| 56 | $method_frame->reply_code || 503, | ||||||||||||||||||||||||||||
| 57 | $method_frame->reply_text || 'Something went wrong.', | ||||||||||||||||||||||||||||
| 58 | )); | ||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | else { | ||||||||||||||||||||||||||||
| 61 | 0 | $cv->croak(longmess(Dumper($why))); | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 1 | 1; | |||||||||||||||||||||||||||
| 67 | __END__ | ||||||||||||||||||||||||||||