line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Gnats::Command::INPUTDEFAULT; |
2
|
40
|
|
|
40
|
|
188
|
use parent 'Net::Gnats::Command'; |
|
40
|
|
|
|
|
60
|
|
|
40
|
|
|
|
|
206
|
|
3
|
40
|
|
|
40
|
|
2414
|
use strictures; |
|
40
|
|
|
|
|
107
|
|
|
40
|
|
|
|
|
193
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
40
|
|
|
40
|
|
3347
|
$Net::Gnats::Command::INPUTDEFAULT::VERSION = '0.21'; |
6
|
|
|
|
|
|
|
} |
7
|
40
|
|
|
40
|
|
247
|
use vars qw($VERSION); |
|
40
|
|
|
|
|
59
|
|
|
40
|
|
|
|
|
1703
|
|
8
|
|
|
|
|
|
|
|
9
|
40
|
|
|
40
|
|
222
|
use Net::Gnats::Constants qw(CODE_INFORMATION CODE_INVALID_FIELD_NAME); |
|
40
|
|
|
|
|
68
|
|
|
40
|
|
|
|
|
11928
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Net::Gnats::Command::INPUTDEFAULT |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Like the FDSC and FTYP commands, multiple field names may be listed |
18
|
|
|
|
|
|
|
with the command, and a response line will be returned for each one |
19
|
|
|
|
|
|
|
in the order that the fields appear on the command line. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 PROTOCOL |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
INPUTDEFAULT [fields...] |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 RESPONSES |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Returns the suggested default value for a field when a PR is |
28
|
|
|
|
|
|
|
initially created. The possible responses are either 410 |
29
|
|
|
|
|
|
|
(CODE_INVALID_FIELD_NAME), meaning that the specified field is |
30
|
|
|
|
|
|
|
invalid or nonexistent, or 350 (CODE_INFORMATION) which contains the |
31
|
|
|
|
|
|
|
default value for the field. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $c = 'INPUTDEFAULT'; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
38
|
41
|
|
|
41
|
1
|
184
|
my ( $class, %options ) = @_; |
39
|
|
|
|
|
|
|
|
40
|
41
|
|
|
|
|
145
|
my $self = bless \%options, $class; |
41
|
41
|
|
|
|
|
217
|
$self->{requests_multi} = 0; |
42
|
41
|
100
|
|
|
|
174
|
return $self if not defined $self->{fields}; |
43
|
|
|
|
|
|
|
|
44
|
40
|
50
|
|
|
|
211
|
if (ref $self->{fields} eq 'ARRAY') { |
45
|
40
|
100
|
|
|
|
66
|
$self->{requests_multi} = 1 if scalar @{ $self->{fields} } > 1; |
|
40
|
|
|
|
|
188
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
else { |
48
|
0
|
|
|
|
|
0
|
$self->{fields} = [ $self->{fields} ]; |
49
|
|
|
|
|
|
|
} |
50
|
40
|
|
|
|
|
127
|
return $self; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub as_string { |
54
|
85
|
|
|
85
|
1
|
150
|
my ($self) = @_; |
55
|
85
|
100
|
|
|
|
259
|
return undef if not defined $self->{fields}; |
56
|
84
|
|
|
|
|
178
|
return $c . ' ' . join ( ' ', @{$self->{fields}} ); |
|
84
|
|
|
|
|
11512
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# this command can take multiple fields, each getting their own response. |
60
|
|
|
|
|
|
|
# so, we check that 'everything' is okay by looking at the parent response. |
61
|
|
|
|
|
|
|
sub is_ok { |
62
|
3
|
|
|
3
|
0
|
4
|
my $self = shift; |
63
|
3
|
100
|
|
|
|
8
|
return 0 if not defined $self->response; |
64
|
2
|
100
|
66
|
|
|
15
|
if ( $self->{requests_multi} == 0 and |
65
|
|
|
|
|
|
|
$self->response->code == CODE_INFORMATION) { |
66
|
1
|
|
|
|
|
6
|
return 1; |
67
|
|
|
|
|
|
|
} |
68
|
1
|
50
|
|
|
|
6
|
return 1 if $self->response->code == CODE_INFORMATION; |
69
|
0
|
|
|
|
|
|
return 0; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |