File Coverage

blib/lib/Net/Gnats/Command/FVLD.pm
Criterion Covered Total %
statement 22 23 95.6
branch 5 6 83.3
condition n/a
subroutine 8 8 100.0
pod 2 3 66.6
total 37 40 92.5


line stmt bran cond sub pod time code
1             package Net::Gnats::Command::FVLD;
2 40     40   195 use parent 'Net::Gnats::Command';
  40         55  
  40         223  
3 40     40   2210 use strictures;
  40         70  
  40         185  
4             BEGIN {
5 40     40   3343 $Net::Gnats::Command::FVLD::VERSION = '0.21';
6             }
7 40     40   213 use vars qw($VERSION);
  40         67  
  40         1742  
8              
9 40     40   243 use Net::Gnats::Constants qw(CODE_TEXT_READY CODE_INVALID_FIELD_NAME);
  40         55  
  40         8208  
10              
11             =head1 NAME
12              
13             Net::Gnats::Command::FVLD
14              
15             =head1 DESCRIPTION
16              
17             Returns one or more regular expressions or strings that describe the
18             valid types of data that can be placed in field. Exactly what is
19             returned is dependent on the type of data that can be stored in the
20             field. For most fields a regular expression is returned; for
21             enumerated fields, the returned values are the list of legal strings
22             that can be held in the field.
23              
24             =head1 PROTOCOL
25              
26             FVLD [field]
27              
28             =head1 RESPONSES
29              
30             The possible responses are:
31              
32             301 (CODE_TEXT_READY)
33              
34             The normal response, which is followed by the list of regexps or
35             strings.
36              
37             410 (CODE_INVALID_FIELD_NAME)
38              
39             The specified field does not exist.
40              
41             =cut
42              
43             my $c = 'FVLD';
44              
45             sub new {
46 3     3 1 9 my ( $class, %options ) = @_;
47              
48 3         9 my $self = bless \%options, $class;
49 3         7 return $self;
50             }
51              
52             sub as_string {
53 9     9 1 12 my $self = shift;
54 9 100       37 return undef if not defined $self->{field};
55 8         38 return $c . ' ' . $self->{field};
56             }
57              
58             sub is_ok {
59 3     3 0 4 my $self = shift;
60 3 100       13 return 0 if not defined $self->response;
61 2 50       7 return 1 if $self->response->code == CODE_TEXT_READY;
62 0           return 0;
63             }
64              
65             1;