| 1 | package Net::Gnats::Command::VFLD; | ||||||||||
| 2 | 40 | ▶ | use parent 'Net::Gnats::Command'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 40 | ▶ | use strictures; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 40 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 40 | $Net::Gnats::Command::VFLD::VERSION = '0.22'; | |||||||||
| 6 | } | ||||||||||
| 7 | 40 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 40 | ▶ | use Net::Gnats::Constants qw(CODE_OK CODE_SEND_TEXT CODE_INVALID_FIELD_NAME); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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 <Field> | ||||||||||
| 36 | <Field contents> | ||||||||||
| 37 | |||||||||||
| 38 | =head1 RESPONSES | ||||||||||
| 39 | |||||||||||
| 40 | CODE_SEND_TEXT | ||||||||||
| 41 | CODE_INVALID_FIELD_NAME | ||||||||||
| 42 | |||||||||||
| 43 | =cut | ||||||||||
| 44 | |||||||||||
| 45 | 40 | my $c = 'VFLD'; | |||||||||
| 46 | |||||||||||
| 47 | 2 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 48 | 2 | my ( $class, %options ) = @_; | |||||||||
| 49 | 2 | my $self = bless \%options, $class; | |||||||||
| 50 | 2 | return $self; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 5 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 54 | 5 | my ($self) = @_; | |||||||||
| 55 | 5 | ▶ | return undef if not defined $self->{field}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 3 | return $c . ' ' . $self->field->name; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 2 | ▶ | sub is_ok { | ||||||||
|
Subroutine
is_ok: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||
| 60 | 2 | my ($self) = @_; | |||||||||
| 61 | 2 | ▶ | return 0 if not defined $self->response; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 1 | ▶ | return 1 if $self->response->code == CODE_OK; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | return 0; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 40 | 1; | |||||||||