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   201 use parent 'Net::Gnats::Command';
  40         56  
  40         193  
3 40     40   2073 use strictures;
  40         67  
  40         196  
4             BEGIN {
5 40     40   2975 $Net::Gnats::Command::FVLD::VERSION = '0.20';
6             }
7 40     40   171 use vars qw($VERSION);
  40         51  
  40         1436  
8              
9 40     40   168 use Net::Gnats::Constants qw(CODE_TEXT_READY CODE_INVALID_FIELD_NAME);
  40         50  
  40         7278  
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 6 my ( $class, %options ) = @_;
47              
48 3         5 my $self = bless \%options, $class;
49 3         5 return $self;
50             }
51              
52             sub as_string {
53 9     9 1 8 my $self = shift;
54 9 100       26 return undef if not defined $self->{field};
55 8         170 return $c . ' ' . $self->{field};
56             }
57              
58             sub is_ok {
59 3     3 0 4 my $self = shift;
60 3 100       12 return 0 if not defined $self->response;
61 2 50       4 return 1 if $self->response->code == CODE_TEXT_READY;
62 0           return 0;
63             }
64              
65             1;