line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Gnats::Command::REPL; |
2
|
40
|
|
|
40
|
|
187
|
use parent 'Net::Gnats::Command'; |
|
40
|
|
|
|
|
56
|
|
|
40
|
|
|
|
|
187
|
|
3
|
40
|
|
|
40
|
|
2127
|
use strictures; |
|
40
|
|
|
|
|
65
|
|
|
40
|
|
|
|
|
173
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
40
|
|
|
40
|
|
3282
|
$Net::Gnats::Command::REPL::VERSION = '0.20'; |
6
|
|
|
|
|
|
|
} |
7
|
40
|
|
|
40
|
|
185
|
use vars qw($VERSION); |
|
40
|
|
|
|
|
57
|
|
|
40
|
|
|
|
|
1664
|
|
8
|
|
|
|
|
|
|
|
9
|
40
|
|
|
40
|
|
186
|
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); |
|
40
|
|
|
|
|
55
|
|
|
40
|
|
|
|
|
9004
|
|
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 |
26
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
my $c = 'REPL'; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub new { |
58
|
8
|
|
|
8
|
1
|
20
|
my ( $class, %options ) = @_; |
59
|
|
|
|
|
|
|
|
60
|
8
|
|
|
|
|
19
|
my $self = bless \%options, $class; |
61
|
8
|
|
|
|
|
24
|
return $self; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub as_string { |
65
|
13
|
|
|
13
|
1
|
13
|
my ($self) = @_; |
66
|
13
|
100
|
|
|
|
44
|
return undef if not defined $self->{pr_number}; |
67
|
11
|
100
|
|
|
|
25
|
return undef if not defined $self->{field}; |
68
|
10
|
|
|
|
|
32
|
return $c . ' ' . $self->{pr_number} . ' ' . $self->{field}->name; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub is_ok { |
72
|
8
|
|
|
8
|
0
|
14
|
my ($self) = @_; |
73
|
8
|
100
|
|
|
|
19
|
return 0 if not defined $self->response; |
74
|
5
|
50
|
|
|
|
12
|
return 1 if $self->response->code == CODE_OK; |
75
|
0
|
|
|
|
|
|
return 0; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |