Gnats/Command/FTYPINFO.pm

filter: Statementstmt 96.3% 26 / 27 Branchbran 70.0% 7 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 89.5% 43 / 48 CC 6 SCAR 7.5
CC
6
Cov
89%
is_ok
3.1
as_string
3.0
new
2.0
CRAP 2.1
« Gnats/Command/CHEK.pm ↑ Summary Gnats/Command/EDIT.pm »
1 package Net::Gnats::Command::FTYPINFO;
2 40 ▶use parent 'Net::Gnats::Command';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 40 ▶use strictures;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
5 40 $Net::Gnats::Command::FTYPINFO::VERSION = '0.22';
6 }
7 40 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 40 ▶use Net::Gnats::Constants qw(CODE_INFORMATION CODE_INVALID_FTYPE_PROPERTY);
Subroutine BEGIN: called CC=1 SCAR=0.0
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 40 my $c = 'FTYPINFO';
45  
46 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod documented
47 3 my ( $class, %options ) = @_;
48 3 my $self = bless \%options, $class;
49 3 ▶ $self->{property} = 'separators' if not defined $self->{property};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"property"} 3 0 3
50 3 return $self;
51 }
52  
53 9 ▶sub as_string {
Subroutine as_string: called CC=3 SCAR=11.0
Pod documented
54 9 my $self = shift;
55 9 ▶ return undef if not defined $self->{field};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"field"} 1 8 9
56 8 ▶ return undef if not defined $self->{property};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"property"} 0 8 8
57 8 return $c . ' ' . $self->{field} . ' ' . $self->{property};
58 }
59  
60 3 ▶sub is_ok {
Subroutine is_ok: called CC=3 SCAR=11.4
Pod undocumented
61 3 my $self = shift;
62 3 ▶ return 0 if not defined $self->response;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response 1 2 3
63 2 ▶ return 1 if $self->response->code eq CODE_INFORMATION;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code eq 350 2 0 2
64 0 return 0;
65 }
66  
67 40 1;
« Gnats/Command/CHEK.pm ↑ Summary Gnats/Command/EDIT.pm »