line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Gnats::Command::VFLD; |
2
|
40
|
|
|
40
|
|
205
|
use parent 'Net::Gnats::Command'; |
|
40
|
|
|
|
|
84
|
|
|
40
|
|
|
|
|
229
|
|
3
|
40
|
|
|
40
|
|
2228
|
use strictures; |
|
40
|
|
|
|
|
75
|
|
|
40
|
|
|
|
|
222
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
40
|
|
|
40
|
|
8962
|
$Net::Gnats::Command::VFLD::VERSION = '0.22'; |
6
|
|
|
|
|
|
|
} |
7
|
40
|
|
|
40
|
|
202
|
use vars qw($VERSION); |
|
40
|
|
|
|
|
72
|
|
|
40
|
|
|
|
|
1649
|
|
8
|
|
|
|
|
|
|
|
9
|
40
|
|
|
40
|
|
251
|
use Net::Gnats::Constants qw(CODE_OK CODE_SEND_TEXT CODE_INVALID_FIELD_NAME); |
|
40
|
|
|
|
|
91
|
|
|
40
|
|
|
|
|
9812
|
|
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
|
|
|
|
|
7
|
return $self; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub as_string { |
54
|
5
|
|
|
5
|
1
|
11
|
my ($self) = @_; |
55
|
5
|
100
|
|
|
|
29
|
return undef if not defined $self->{field}; |
56
|
3
|
|
|
|
|
17
|
return $c . ' ' . $self->field->name; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub is_ok { |
60
|
2
|
|
|
2
|
0
|
3
|
my ($self) = @_; |
61
|
2
|
100
|
|
|
|
11
|
return 0 if not defined $self->response; |
62
|
1
|
50
|
|
|
|
4
|
return 1 if $self->response->code == CODE_OK; |
63
|
0
|
|
|
|
|
|
return 0; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |