line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Gnats::Command::LIST; |
2
|
40
|
|
|
40
|
|
184
|
use parent 'Net::Gnats::Command'; |
|
40
|
|
|
|
|
62
|
|
|
40
|
|
|
|
|
204
|
|
3
|
40
|
|
|
40
|
|
2232
|
use strictures; |
|
40
|
|
|
|
|
74
|
|
|
40
|
|
|
|
|
192
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
40
|
|
|
40
|
|
3302
|
$Net::Gnats::Command::LIST::VERSION = '0.21'; |
6
|
|
|
|
|
|
|
} |
7
|
40
|
|
|
40
|
|
216
|
use vars qw($VERSION); |
|
40
|
|
|
|
|
79
|
|
|
40
|
|
|
|
|
2134
|
|
8
|
|
|
|
|
|
|
|
9
|
40
|
|
|
40
|
|
213
|
use Net::Gnats::Constants qw(CODE_TEXT_READY CODE_INVALID_LIST); |
|
40
|
|
|
|
|
66
|
|
|
40
|
|
|
|
|
17166
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Net::Gnats::Command::LIST |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Describes various aspects of the database. The lists are returned as |
19
|
|
|
|
|
|
|
a list of records, one per line. Each line may contain a number of |
20
|
|
|
|
|
|
|
colon-separated fields. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Possible values for list type include |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Categories : Describes the legal categories for the database. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Submitters : Describes the set of submitters for the database. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Responsible : Lists the names in the responsible administrative |
29
|
|
|
|
|
|
|
file, including their full names and email addresses. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
States |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Lists the states listed in the state administrative file, including |
34
|
|
|
|
|
|
|
the state type (usually blank for most states; the closed state has |
35
|
|
|
|
|
|
|
a special type). |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
FieldNames Lists the entire set of PR fields. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
InitialInputFields : Lists the fields that should be present when a |
40
|
|
|
|
|
|
|
PR is initially entered. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
InitialRequiredFields : Lists fields that have to be present and |
43
|
|
|
|
|
|
|
nonempty when a PR is initially entered (fields containing only |
44
|
|
|
|
|
|
|
blank characters such as spaces or newlines are considered empty.) |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Databases : Lists the set of databases. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 PROTOCOL |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
LIST [list type] |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 RESPONSES |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
The possible responses are: |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
301 (CODE_TEXT_READY) Normal response, followed by the records |
57
|
|
|
|
|
|
|
making up the list as described above. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
416 (CODE_INVALID_LIST) The requested list does not exist. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $c = 'LIST'; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $s = { databases => ['name', 'desc', 'path'], |
66
|
|
|
|
|
|
|
categories => ['name', 'desc', 'contact', 'notify'], |
67
|
|
|
|
|
|
|
submitters => ['name', 'desc', 'contract', 'response', |
68
|
|
|
|
|
|
|
'contact', 'othernotify'], |
69
|
|
|
|
|
|
|
responsible => ['name', 'realname', 'email'], |
70
|
|
|
|
|
|
|
states => ['name', 'type', 'desc'], |
71
|
|
|
|
|
|
|
}; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub new { |
74
|
133
|
|
|
133
|
1
|
415
|
my ( $class, %options ) = @_; |
75
|
133
|
|
|
|
|
367
|
my $self = bless \%options, $class; |
76
|
133
|
|
|
|
|
366
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub as_string { |
80
|
279
|
|
|
279
|
1
|
318
|
my $self = shift; |
81
|
279
|
100
|
|
|
|
898
|
return undef if not defined $self->{subcommand}; |
82
|
277
|
|
|
|
|
1058
|
return $c . ' ' . $self->{subcommand}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub is_ok { |
86
|
8
|
|
|
8
|
0
|
10
|
my $self = shift; |
87
|
8
|
50
|
|
|
|
16
|
return 0 if not defined $self->response; |
88
|
8
|
50
|
|
|
|
19
|
return 1 if $self->response->code == CODE_TEXT_READY; |
89
|
0
|
|
|
|
|
0
|
return 0; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub formatted { |
93
|
10
|
|
|
10
|
0
|
20
|
my $self = shift; |
94
|
10
|
50
|
|
|
|
21
|
return [] if not defined $self->response; |
95
|
10
|
50
|
|
|
|
27
|
return [] if $self->response->code != CODE_TEXT_READY; |
96
|
|
|
|
|
|
|
|
97
|
10
|
|
|
|
|
31
|
my $keynames = $s->{lc $self->{subcommand}}; |
98
|
|
|
|
|
|
|
|
99
|
10
|
|
|
|
|
13
|
my $result = []; |
100
|
10
|
|
|
|
|
11
|
foreach my $row (@{ $self->response->as_list }) { |
|
10
|
|
|
|
|
20
|
|
101
|
14
|
|
|
|
|
52
|
my @parts = split ':', $row; |
102
|
14
|
|
|
|
|
23
|
push @{ $result}, { map { @{ $keynames }[$_] => |
|
50
|
|
|
|
|
41
|
|
|
50
|
|
|
|
|
194
|
|
|
14
|
|
|
|
|
34
|
|
103
|
14
|
|
|
|
|
16
|
$parts[$_] } 0..( scalar @{$keynames} - 1) }; |
104
|
|
|
|
|
|
|
} |
105
|
10
|
|
|
|
|
59
|
return $result; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |