File Coverage

blib/lib/Net/Gnats/Command/FTYPINFO.pm
Criterion Covered Total %
statement 24 25 96.0
branch 7 10 70.0
condition n/a
subroutine 8 8 100.0
pod 2 3 66.6
total 41 46 89.1


line stmt bran cond sub pod time code
1             package Net::Gnats::Command::FTYPINFO;
2 40     40   171 use parent 'Net::Gnats::Command';
  40         57  
  40         182  
3 40     40   2087 use strictures;
  40         59  
  40         171  
4             BEGIN {
5 40     40   3120 $Net::Gnats::Command::FTYPINFO::VERSION = '0.20';
6             }
7 40     40   193 use vars qw($VERSION);
  40         61  
  40         1489  
8              
9 40     40   184 use Net::Gnats::Constants qw(CODE_INFORMATION CODE_INVALID_FTYPE_PROPERTY);
  40         57  
  40         8251  
10              
11             =head1 NAME
12              
13             Net::Gnats::Command::FTYPINFO
14              
15             =head1 DESCRIPTION
16              
17             Provides field-type-related information. Currently, only the
18             property separators for MultiEnum fields is supported. When
19             separators is specified, the possible return codes are:
20              
21             =head1 PROTOCOL
22              
23             FTYPINFO [field] [property]
24              
25             =head1 RESPONSES
26              
27             350 (CODE_INFORMATION)
28              
29             A proper MultiEnum field was specified and the returned text is the
30             string of separators specified for the field in the dbconfig file
31             (see Field datatypes) quoted in ''s.
32              
33             435 (CODE_INVALID_FTYPE_PROPERTY)
34              
35             The separators property is not defined for this field, i.e. the
36             specified field is not of type MultiEnum.
37              
38             Currently, specifying a different property than separators results
39             in return code 435 as above.
40              
41             =cut
42              
43              
44             my $c = 'FTYPINFO';
45              
46             sub new {
47 3     3 1 6 my ( $class, %options ) = @_;
48 3         7 my $self = bless \%options, $class;
49 3 50       11 $self->{property} = 'separators' if not defined $self->{property};
50 3         7 return $self;
51             }
52              
53             sub as_string {
54 9     9 1 8 my $self = shift;
55 9 100       22 return undef if not defined $self->{field};
56 8 50       14 return undef if not defined $self->{property};
57 8         25 return $c . ' ' . $self->{field} . ' ' . $self->{property};
58             }
59              
60             sub is_ok {
61 3     3 0 3 my $self = shift;
62 3 100       11 return 0 if not defined $self->response;
63 2 50       5 return 1 if $self->response->code eq CODE_INFORMATION;
64 0           return 0;
65             }
66              
67             1;