Gnats/Command/REPL.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 87.5% 7 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 93.3% 42 / 45 CC 5 SCAR 7.1
CC
5
Cov
94%
is_ok
3.1
as_string
3.0
BEGIN
1.0
CRAP 2.0
« Gnats/Command/APPN.pm ↑ Summary Gnats/FieldInstance.pm »
1 package Net::Gnats::Command::REPL;
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::REPL::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_NONEXISTENT_PR CODE_INVALID_FIELD_NAME CODE_UNREADABLE_PR CODE_GNATS_LOCKED CODE_LOCKED_PR CODE_INVALID_FIELD_CONTENTS);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Net::Gnats::Command::REPL
14  
15 =head1 DESCRIPTION
16  
17 Appends to or replaces the contents of field in PR with the supplied
18 text. The command returns a 201 (CODE_SEND_TEXT) response; the
19 client should then transmit the new field contents using the
20 standard PR quoting mechanism. After the server has read the new
21 contents, it then attempts to make the requested change to the PR.
22  
23 =head1 PROTOCOL
24  
25 REPL <PR number> <field>
26 <CONTENTS>
27  
28 =head1 RESPONSES
29  
30 The possible responses are:
31  
32 200 (CODE_OK) The PR field was successfully changed.
33  
34 400 (CODE_NONEXISTENT_PR) The PR specified does not exist.
35  
36 410 (CODE_INVALID_FIELD_NAME) The specified field does not exist.
37  
38 402 (CODE_UNREADABLE_PR) The PR could not be read.
39  
40 431 (CODE_GNATS_LOCKED) The database has been locked, and no PRs may
41 be updated until the lock is cleared.
42  
43 430 (CODE_LOCKED_PR) The PR is locked, and may not be altered until
44 the lock is cleared.
45  
46 413 (CODE_INVALID_FIELD_CONTENTS) The supplied (or resulting) field
47 contents are not valid for the field.
48  
49 6xx (internal error) An internal error occurred, usually because of
50 permission or other filesystem-related problems. The PR may or may
51 not have been altered.
52  
53 =cut
54  
55 40 my $c = 'REPL';
56  
57 9 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
58 9 my ( $class, %options ) = @_;
59  
60 9 my $self = bless \%options, $class;
61 9 return $self;
62 }
63  
64 15 ▶sub as_string {
Subroutine as_string: called CC=3 SCAR=11.0
Pod documented
65 15 my ($self) = @_;
66 15 ▶ return undef if not defined $self->{pr_number};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"pr_number"} 2 13 15
67 13 ▶ return undef if not defined $self->{field};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"field"} 1 12 13
68 12 return $c . ' ' . $self->{pr_number} . ' ' . $self->{field}->name;
69 }
70  
71 9 ▶sub is_ok {
Subroutine is_ok: called CC=3 SCAR=11.4
Pod undocumented
72 9 my ($self) = @_;
73 9 ▶ return 0 if not defined $self->response;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response 3 6 9
74 6 ▶ return 1 if $self->response->code == CODE_OK;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code == 210 6 0 6
75 0 return 0;
76 }
77  
78 40 1;
« Gnats/Command/APPN.pm ↑ Summary Gnats/FieldInstance.pm »