Gnats/Command/SUBM.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/EDITADDR.pm ↑ Summary Gnats/Command/CHEK.pm »
1 package Net::Gnats::Command::SUBM;
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::SUBM::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_GNATS_LOCKED CODE_SEND_PR CODE_INFORMATION_FILLER CODE_INFORMATION);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Net::Gnats::Command::SUBM
14  
15 =head1 DESCRIPTION
16  
17 Submits a new PR into the database. The supplied text is verified for
18 correctness, and if no problems are found a new PR is created.
19  
20 =head1 PROTOCOL
21  
22 SUBM
23 <PR CONTENTS>
24  
25 =head1 RESPONSES
26  
27 The possible responses are:
28  
29 431 (CODE_GNATS_LOCKED) The database has been locked, and no PRs may
30 be submitted until the lock is cleared.
31  
32 211 (CODE_SEND_PR) The client should now transmit the new PR text
33 using the normal quoting mechanism. After the PR has been sent, the
34 server will respond with either
35  
36 351 (CODE_INFORMATION_FILLER) and
37 350 (CODE_INFORMATION) responses indicating that the new PR has been
38 created and supplying the number assigned to it, or one or more
39 error codes listing problems with the new PR text.
40  
41 =cut
42  
43 40 my $c = 'SUBM';
44  
45 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
46 7 my ( $class, %options ) = @_;
47  
48 7 my $self = bless \%options, $class;
49 7 return $self;
50 }
51  
52 13 ▶sub as_string {
Subroutine as_string: called CC=2 SCAR=6.9
Pod documented
53 13 my ($self) = @_;
54 13 ▶ return undef if not defined $self->{pr};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"pr"} 1 12 13
55 12 return $c;
56 }
57  
58 7 ▶sub is_ok {
Subroutine is_ok: called CC=4 SCAR=14.6
Pod undocumented
59 7 my ($self) = @_;
60 # command not run yet
61 7 ▶ return 0 if not defined $self->response;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response 1 6 7
62 # malformed response
63 6 ▶ return 0 if not defined $self->response->code;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response->code 0 6 6
64 6 ▶ return 1 if $self->response->code == CODE_INFORMATION;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code == 350 6 0 6
65 0 return 0;
66 }
67  
68 40 1;
« Gnats/Command/EDITADDR.pm ↑ Summary Gnats/Command/CHEK.pm »