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   183 use parent 'Net::Gnats::Command';
  40         65  
  40         208  
3 40     40   2366 use strictures;
  40         70  
  40         199  
4             BEGIN {
5 40     40   3273 $Net::Gnats::Command::FTYPINFO::VERSION = '0.21';
6             }
7 40     40   219 use vars qw($VERSION);
  40         62  
  40         1781  
8              
9 40     40   201 use Net::Gnats::Constants qw(CODE_INFORMATION CODE_INVALID_FTYPE_PROPERTY);
  40         62  
  40         9029  
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 8 my ( $class, %options ) = @_;
48 3         9 my $self = bless \%options, $class;
49 3 50       20 $self->{property} = 'separators' if not defined $self->{property};
50 3         10 return $self;
51             }
52              
53             sub as_string {
54 9     9 1 15 my $self = shift;
55 9 100       45 return undef if not defined $self->{field};
56 8 50       19 return undef if not defined $self->{property};
57 8         39 return $c . ' ' . $self->{field} . ' ' . $self->{property};
58             }
59              
60             sub is_ok {
61 3     3 0 5 my $self = shift;
62 3 100       13 return 0 if not defined $self->response;
63 2 50       8 return 1 if $self->response->code eq CODE_INFORMATION;
64 0           return 0;
65             }
66              
67             1;