Gnats/Command/CHEK.pm

filter: Statementstmt 87.5% 21 / 24 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 66.6% 2 / 3 totaltotal 82.0% 32 / 39 CC 3 SCAR 7.9
CC
3
Cov
82%
is_ok
6.0
as_string
2.0
BEGIN
1.0
CRAP 2.2
« Gnats/Command/SUBM.pm ↑ Summary Gnats/Command/FTYPINFO.pm »
1 package Net::Gnats::Command::CHEK;
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::CHEK::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_SEND_PR CODE_OK CODE_CMD_ERROR);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Net::Gnats::Command::CHEK
14  
15 =head1 DESCRIPTION
16  
17 Used to check the text of an entire PR for errors. Unlike the VFLD
18 command, it accepts an entire PR at once instead of the contents of an
19 individual field.
20  
21 The initial argument indicates that the PR text to be checked is for a
22 PR that will be newly created, rather than an edit or replacement of
23 an existing PR.
24  
25 =heads EXAMPLES
26  
27 # Check an initial PR
28 Net::Gnats::Command::CHEK(pr => $pr, type = 'initial');
29  
30 # Check a modified PR
31 Net::Gnats::Command::CHEK(pr => $pr);
32  
33 # Issue to Gnats
34 $session->issue(Net::Gnats::Command::CHEK(pr => $pr))->is_ok;
35  
36 # If running from Net::Gnats object
37 $g->session->issue(Net::Gnats::Command::CHEK(pr => $pr))->is_ok;
38  
39 =head1 PROTOCOL
40  
41 CHEK [initial]
42  
43 =head1 RESPONSES
44  
45 After the CHEK command is issued, the server will respond with either
46 a 440 (CODE_CMD_ERROR) response indicating that the command arguments
47 were incorrect, or a 211 (CODE_SEND_PR) response code will be sent.
48  
49 Once the 211 response is received from the server, the client should
50 send the PR using the normal PR quoting mechanism; the final line of
51 the PR is then followed by a line containing a single period, as
52 usual.
53  
54 The server will then respond with either a 200 (CODE_OK) response,
55 indicating there were no problems with the supplied text, or one or
56 more error codes listing the problems with the PR.
57  
58 =cut
59  
60 40 my $c = 'CHEK';
61  
62 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
63 3 my ( $class, %options ) = @_;
64 3 my $self = bless \%options, $class;
65 3 return $self;
66 }
67  
68 4 ▶sub as_string {
Subroutine as_string: called CC=2 SCAR=6.9
Pod documented
69 4 my $self = shift;
70 4 ▶ return $c . ' ' . $self->{type} if defined $self->{type};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"type"} 3 1 4
71 1 return $c;
72 }
73  
74 0 ▶sub is_ok {
Subroutine is_ok: not called CC=2 SCAR=17.9
Pod undocumented
75 0 my $self = shift;
76 0 ▶ return 1 if $self->response->code == CODE_OK;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code == 210 0 0 0
77 0 return 0;
78 }
79  
80 40 1;
« Gnats/Command/SUBM.pm ↑ Summary Gnats/Command/FTYPINFO.pm »