RabbitFoot/Cmd/Command/declare_queue.pm

filter: Statementstmt 55.5% 15 / 27 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 2 / 5 Podpod 100% 1 / 1 totaltotal 51.4% 18 / 35 CC 3 SCAR 13.9
CC
3
Cov
52%
_validate_queue
6.0
_run
6.0
abstract
2.0
CRAP 4.0
« RabbitFoot/Cmd/Command/unbind_queue.pm ↑ Summary RabbitFoot/Cmd/Command/declare_exchange.pm »
1 package Net::RabbitFoot::Cmd::Command::declare_queue;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 extends qw(MooseX::App::Cmd::Command);
5 1 with qw(Net::RabbitFoot::Cmd::Role::Config Net::RabbitFoot::Cmd::Role::Command);
6  
7 1 has queue => (
8 isa => 'Str',
9 is => 'rw',
10 default => '',
11 metaclass => 'MooseX::Getopt::Meta::Attribute',
12 cmd_aliases => 'q',
13 documentation => 'queue name',
14 );
15  
16 1 has passive => (
17 isa => 'Bool',
18 is => 'rw',
19 default => 0,
20 metaclass => 'MooseX::Getopt::Meta::Attribute',
21 # cmd_aliases => 'p',
22 documentation => 'do not create queue',
23 );
24  
25 1 has durable => (
26 isa => 'Bool',
27 is => 'rw',
28 default => 0,
29 metaclass => 'MooseX::Getopt::Meta::Attribute',
30 cmd_aliases => 'd',
31 documentation => 'request a durable queue',
32 );
33  
34 1 has exclusive => (
35 isa => 'Bool',
36 is => 'rw',
37 default => 0,
38 metaclass => 'MooseX::Getopt::Meta::Attribute',
39 cmd_aliases => 'e',
40 documentation => 'request an exclusive queue',
41 );
42  
43 1 has auto_delete => (
44 isa => 'Bool',
45 is => 'rw',
46 default => 0,
47 metaclass => 'MooseX::Getopt::Meta::Attribute',
48 cmd_aliases => 'a',
49 documentation => 'auto delete queue when unused',
50 );
51  
52 1 __PACKAGE__->meta->make_immutable;
53 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
54  
55 0 ▶sub abstract {
Subroutine abstract: not called CC=1 SCAR=6.9
Pod documented
56 0 return 'declare queue, create if needed';
57 }
58  
59 0 ▶sub _validate_queue {
Subroutine _validate_queue: not called CC=2 SCAR=17.9
60 0 my ($self,) = @_;
61  
62 0 ▶ return if !$self->queue;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->queue 0 0 0
63 0 $self->_check_queue();
64 0 return;
65 }
66  
67 0 ▶sub _run {
Subroutine _run: not called CC=2 SCAR=17.9
68 0 my ($self, $client, $opt, $args,) = @_;
69  
70 my $method_frame = $client->declare_queue(
71 0 (map {$_ => $self->$_} qw(queue passive durable exclusive auto_delete))
72 )->method_frame;
73  
74 0 print 'Declared queue', "\n";
75 0 for my $method (qw(queue message_count consumer_count)) {
76 0 print $method, ': ', $method_frame->$method, "\n";
77 }
78 0 return;
79 }
80  
81 1 1;
82  
« RabbitFoot/Cmd/Command/unbind_queue.pm ↑ Summary RabbitFoot/Cmd/Command/declare_exchange.pm »