line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Gnats::Command::VFLD; |
2
|
40
|
|
|
40
|
|
217
|
use parent 'Net::Gnats::Command'; |
|
40
|
|
|
|
|
66
|
|
|
40
|
|
|
|
|
226
|
|
3
|
40
|
|
|
40
|
|
2268
|
use strictures; |
|
40
|
|
|
|
|
64
|
|
|
40
|
|
|
|
|
202
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
40
|
|
|
40
|
|
3709
|
$Net::Gnats::Command::VFLD::VERSION = '0.21'; |
6
|
|
|
|
|
|
|
} |
7
|
40
|
|
|
40
|
|
213
|
use vars qw($VERSION); |
|
40
|
|
|
|
|
99
|
|
|
40
|
|
|
|
|
1989
|
|
8
|
|
|
|
|
|
|
|
9
|
40
|
|
|
40
|
|
294
|
use Net::Gnats::Constants qw(CODE_OK CODE_SEND_TEXT CODE_INVALID_FIELD_NAME); |
|
40
|
|
|
|
|
75
|
|
|
40
|
|
|
|
|
8883
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Net::Gnats::Command::VFLD |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
VFLD can be used to validate a given value for a field in the |
18
|
|
|
|
|
|
|
database. The client issues the VFLD command with the name of the |
19
|
|
|
|
|
|
|
field to validate as an argument. The server will either respond |
20
|
|
|
|
|
|
|
with 212 (CODE_SEND_TEXT), or 410 (CODE_INVALID_FIELD_NAME) if the |
21
|
|
|
|
|
|
|
specified field does not exist. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Once the 212 response is received from the server, the client should |
24
|
|
|
|
|
|
|
then send the line(s) of text to be validated, using the normal |
25
|
|
|
|
|
|
|
quoting mechanism described for PRs. The final line of text is |
26
|
|
|
|
|
|
|
followed by a line containing a single period, again as when sending |
27
|
|
|
|
|
|
|
PR text. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
The server will then either respond with 210 (CODE_OK), indicating |
30
|
|
|
|
|
|
|
that the text is acceptable, or one or more error codes describing |
31
|
|
|
|
|
|
|
the problems with the field contents. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 PROTOCOL |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
VFLD |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 RESPONSES |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
CODE_SEND_TEXT |
41
|
|
|
|
|
|
|
CODE_INVALID_FIELD_NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $c = 'VFLD'; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub new { |
48
|
2
|
|
|
2
|
1
|
5
|
my ( $class, %options ) = @_; |
49
|
2
|
|
|
|
|
3
|
my $self = bless \%options, $class; |
50
|
2
|
|
|
|
|
4
|
return $self; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub as_string { |
54
|
5
|
|
|
5
|
1
|
9
|
my ($self) = @_; |
55
|
5
|
100
|
|
|
|
28
|
return undef if not defined $self->{field}; |
56
|
3
|
|
|
|
|
16
|
return $c . ' ' . $self->field->name; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub is_ok { |
60
|
2
|
|
|
2
|
0
|
4
|
my ($self) = @_; |
61
|
2
|
100
|
|
|
|
10
|
return 0 if not defined $self->response; |
62
|
1
|
50
|
|
|
|
3
|
return 1 if $self->response->code == CODE_OK; |
63
|
0
|
|
|
|
|
|
return 0; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |