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   196 use parent 'Net::Gnats::Command';
  40         74  
  40         222  
3 40     40   2127 use strictures;
  40         71  
  40         232  
4             BEGIN {
5 40     40   8795 $Net::Gnats::Command::FVLD::VERSION = '0.22';
6             }
7 40     40   275 use vars qw($VERSION);
  40         69  
  40         1672  
8              
9 40     40   223 use Net::Gnats::Constants qw(CODE_TEXT_READY CODE_INVALID_FIELD_NAME);
  40         76  
  40         8947  
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 8 my ( $class, %options ) = @_;
47              
48 3         6 my $self = bless \%options, $class;
49 3         8 return $self;
50             }
51              
52             sub as_string {
53 9     9 1 13 my $self = shift;
54 9 100       32 return undef if not defined $self->{field};
55 8         31 return $c . ' ' . $self->{field};
56             }
57              
58             sub is_ok {
59 3     3 0 5 my $self = shift;
60 3 100       12 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;