| 1 | package AnyEvent::RabbitMQ::PubSub::Publisher; | ||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use AnyEvent; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||
| 6 | 1 | has channel => ( | |||||||||||||||||||||||||||||
| 7 | is => 'ro', isa => 'AnyEvent::RabbitMQ::Channel', required => 1 | ||||||||||||||||||||||||||||||
| 8 | ); | ||||||||||||||||||||||||||||||
| 9 | 1 | has exchange => ( | |||||||||||||||||||||||||||||
| 10 | is => 'ro', isa => 'HashRef', required => 1 | ||||||||||||||||||||||||||||||
| 11 | ); | ||||||||||||||||||||||||||||||
| 12 | 1 | has routing_key => ( | |||||||||||||||||||||||||||||
| 13 | is => 'ro', isa => 'Str', default => '#' | ||||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||||
| 15 | 1 | has default_header => ( | |||||||||||||||||||||||||||||
| 16 | is => 'ro', isa => 'Maybe[HashRef]' | ||||||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub init { | ||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 20 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||
| 22 | 0 | my $cv = AnyEvent->condvar; | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||
| 24 | $self->channel->declare_exchange( | ||||||||||||||||||||||||||||||
| 25 | 0 | %{ $self->exchange }, | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | on_success => sub { $cv->send() }, | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | on_failure => sub { $cv->croak(@_) }, | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 28 | 0 | ); | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||
| 30 | 0 | $cv->recv(); | |||||||||||||||||||||||||||||
| 31 | return | ||||||||||||||||||||||||||||||
| 32 | 0 | } | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub publish { | ||||||||||||||||||||||||||||
|
Subroutine
publish: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 35 | 0 | my ($self, %options) = @_; | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||
| 37 | $self->channel->publish( | ||||||||||||||||||||||||||||||
| 38 | exchange => $self->exchange->{exchange}, | ||||||||||||||||||||||||||||||
| 39 | routing_key => $self->routing_key, | ||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | on_inactive => sub { die 'Failed to publish: channel inactive' }, | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 41 | %options, | ||||||||||||||||||||||||||||||
| 42 | header => $options{header} // $self->default_header, | ||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | body => $options{body} // '', | ||||||||||||||||||||||||||||
|
Condition0%0/5
$options{"header"} // $self->default_header
$options{"body"} // ""
MC/DC0%0/2
$options{"header"} // $self->default_header
$options{"header"}
$self->default_header
MC/DC0%0/1
$options{"body"} // ""
$options{"body"}
Truth table0%0/3
A // B
A= $options{"header"}B= $self->default_header
Truth table0%0/2
A
A= $options{"body"}
| |||||||||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||
| 47 | 1 | 1 | |||||||||||||||||||||||||||||