line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Gnats::Command::SUBM; |
2
|
40
|
|
|
40
|
|
258
|
use parent 'Net::Gnats::Command'; |
|
40
|
|
|
|
|
78
|
|
|
40
|
|
|
|
|
209
|
|
3
|
40
|
|
|
40
|
|
2079
|
use strictures; |
|
40
|
|
|
|
|
68
|
|
|
40
|
|
|
|
|
207
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
40
|
|
|
40
|
|
8958
|
$Net::Gnats::Command::SUBM::VERSION = '0.22'; |
6
|
|
|
|
|
|
|
} |
7
|
40
|
|
|
40
|
|
198
|
use vars qw($VERSION); |
|
40
|
|
|
|
|
79
|
|
|
40
|
|
|
|
|
1621
|
|
8
|
|
|
|
|
|
|
|
9
|
40
|
|
|
40
|
|
248
|
use Net::Gnats::Constants qw(CODE_GNATS_LOCKED CODE_SEND_PR CODE_INFORMATION_FILLER CODE_INFORMATION); |
|
40
|
|
|
|
|
74
|
|
|
40
|
|
|
|
|
10139
|
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
my $c = 'SUBM'; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
46
|
7
|
|
|
7
|
1
|
20
|
my ( $class, %options ) = @_; |
47
|
|
|
|
|
|
|
|
48
|
7
|
|
|
|
|
21
|
my $self = bless \%options, $class; |
49
|
7
|
|
|
|
|
27
|
return $self; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub as_string { |
53
|
13
|
|
|
13
|
1
|
19
|
my ($self) = @_; |
54
|
13
|
100
|
|
|
|
51
|
return undef if not defined $self->{pr}; |
55
|
12
|
|
|
|
|
42
|
return $c; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub is_ok { |
59
|
7
|
|
|
7
|
0
|
12
|
my ($self) = @_; |
60
|
|
|
|
|
|
|
# command not run yet |
61
|
7
|
100
|
|
|
|
28
|
return 0 if not defined $self->response; |
62
|
|
|
|
|
|
|
# malformed response |
63
|
6
|
50
|
|
|
|
18
|
return 0 if not defined $self->response->code; |
64
|
6
|
50
|
|
|
|
18
|
return 1 if $self->response->code == CODE_INFORMATION; |
65
|
0
|
|
|
|
|
|
return 0; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |