Gnats/Command/QFMT.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 92.8% 39 / 42 CC 4 SCAR 5.7
CC
4
Cov
94%
is_ok
3.1
as_string
2.0
BEGIN
1.0
CRAP 1.8
« Gnats/Command/FVLD.pm ↑ Summary Gnats/Command/VFLD.pm »
1 package Net::Gnats::Command::QFMT;
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::QFMT::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_OK CODE_CMD_ERROR CODE_INVALID_QUERY_FORMAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Net::Gnats::Command::QFMT
14  
15 =head1 DESCRIPTION
16  
17 Use the specified query format to format the output of the QUER
18 command. The query format may be either the name of a query format
19 known to the server (see Named query definitions), or an actual
20 query format (see Formatting query-pr output).
21  
22 =head1 PROTOCOL
23  
24 QFMT <query format>
25  
26 =head1 RESPONSES
27  
28 The possible
29 responses are:
30  
31 210 (CODE_OK) The normal response, which indicates that the query
32 format is acceptable.
33  
34 440 (CODE_CMD_ERROR) No query format was supplied.
35  
36 418 (CODE_INVALID_QUERY_FORMAT) The specified query format does not
37 exist, or could not be parsed.
38  
39 =cut
40  
41 40 my $c = 'QFMT';
42  
43 15 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
44 15 my ( $class, %options ) = @_;
45  
46 15 my $self = bless \%options, $class;
47 15 return $self;
48 }
49  
50 29 ▶sub as_string {
Subroutine as_string: called CC=2 SCAR=6.9
Pod documented
51 29 my $self = shift;
52 29 ▶ return undef if not defined $self->{format};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"format"} 1 28 29
53 28 return $c . ' ' . $self->{format};
54 }
55  
56 15 ▶sub is_ok {
Subroutine is_ok: called CC=3 SCAR=11.4
Pod undocumented
57 15 my $self = shift;
58 15 ▶ return 0 if not defined $self->response;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response 1 14 15
59 14 ▶ return 1 if $self->response->code == CODE_OK;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code == 210 14 0 14
60 0 return 0;
61 }
62  
63 40 1;
« Gnats/Command/FVLD.pm ↑ Summary Gnats/Command/VFLD.pm »