Gnats/Command/EDITADDR.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 91.1% 41 / 45 CC 5 SCAR 8.2
CC
5
Cov
91%
is_ok
4.3
as_string
2.0
BEGIN
1.0
CRAP 2.3
« Gnats/Command/CHDB.pm ↑ Summary Gnats/Command/SUBM.pm »
1 package Net::Gnats::Command::EDITADDR;
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::EDITADDR::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_OK CODE_CMD_ERROR);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Net::Gnats::Command::EDITADDR
14  
15 =head1 DESCRIPTION
16  
17 Sets the e-mail address of the person communicating with gnatsd. The
18 command requires at least the edit access level.
19  
20 =head1 PROTOCOL
21  
22 EDITADDR [address]
23  
24 =head1 RESPONSES
25  
26 The possible responses are:
27  
28 200 (CODE_OK)
29 The address was successfully set.
30  
31 440 (CODE_CMD_ERROR)
32 Invalid number of arguments were supplied.
33  
34 =cut
35  
36  
37 40 my $c = 'EDITADDR';
38  
39 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
40 4 my ( $class, %options ) = @_;
41  
42 4 my $self = bless \%options, $class;
43 4 return $self;
44 }
45  
46 7 ▶sub as_string {
Subroutine as_string: called CC=2 SCAR=6.9
Pod documented
47 7 my ($self) = @_;
48 7 ▶ return undef if not defined $self->{address};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"address"} 1 6 7
49 6 return $c . ' ' . $self->{address};
50 }
51  
52 4 ▶sub is_ok {
Subroutine is_ok: called CC=4 SCAR=14.6
Pod undocumented
53 4 my ($self) = @_;
54 # command not issued
55 4 ▶ return 0 if not defined $self->response;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response 1 3 4
56 # malformed command
57 3 ▶ return 0 if not defined $self->response->code;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response->code 0 3 3
58 3 ▶ return 1 if $self->response->code == CODE_OK;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code == 210 3 0 3
59 0 return 0;
60 }
61  
62 40 1;
« Gnats/Command/CHDB.pm ↑ Summary Gnats/Command/SUBM.pm »