Gnats/Command/QUIT.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 88.1% 37 / 42 CC 4 SCAR 8.6
CC
4
Cov
87%
is_ok
4.8
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
« Gnats/Field.pm ↑ Summary Gnats/Command/CHDB.pm »
1 package Net::Gnats::Command::QUIT;
2 40 ▶use parent 'Net::Gnats::Command';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 40 ▶use strictures;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
5 40 $Net::Gnats::Command::QUIT::VERSION = '0.22';
6 }
7 40 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 40 ▶use Net::Gnats::Constants qw(CODE_CLOSING);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 QUIT
14  
15 =head1 DESCRIPTION
16  
17 Requests that the connection be closed.
18  
19 The QUIT command has the dubious distinction of being the only
20 command that cannot fail.
21  
22 =head1 PROTOCOL
23  
24 QUIT
25  
26 =head1 RESPONSES
27  
28 Possible responses:
29 201 (CODE_CLOSING) Normal exit.
30  
31 =cut
32  
33 40 my $c = 'QUIT';
34  
35 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
36 5 my ( $class, %options ) = @_;
37 5 my $self = bless {}, $class;
38 5 return $self;
39 }
40  
41 10 ▶sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
42 10 my ($self) = @_;
43 10 return $c;
44 }
45  
46 4 ▶sub is_ok {
Subroutine is_ok: called CC=4 SCAR=15.6
Pod undocumented
47 4 my ($self) = @_;
48 4 ▶ return 0 if not defined $self->response;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response 0 4 4
49 4 ▶ return 0 if not defined $self->response->code;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response->code 0 4 4
50 4 ▶ return 1 if $self->response->code == CODE_CLOSING;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code == 201 4 0 4
51 0 return 0;
52 }
53  
54 40 1;
« Gnats/Field.pm ↑ Summary Gnats/Command/CHDB.pm »