Gnats/Command/EXPR.pm

filter: Statementstmt 100% 28 / 28 Branchbran 80.0% 8 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 93.8% 46 / 49 CC 6 SCAR 8.7
CC
6
Cov
95%
is_ok
4.0
as_string
3.0
BEGIN
1.0
CRAP 2.4
« Gnats/Command/USER.pm ↑ Summary Gnats/Field.pm »
1 package Net::Gnats::Command::EXPR;
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::EXPR::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_INVALID_EXPR);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Net::Gnats::Command::EXPR
14  
15 =head1 DESCRIPTION
16  
17  
18 Specifies a query expression used to limit which PRs are returned
19 from the QUER command. The expression uses the normal query
20 expression syntax, (see Query expressions).
21  
22 Multiple EXPR commands may be issued; the expressions are boolean ANDed together.
23  
24 Expressions are cleared by the RSET command.
25  
26 =head1 PROTOCOL
27  
28 EXPR [query expression]
29  
30 =head1 RESPONSES
31  
32  
33 Possible responses include:
34  
35 415 (CODE_INVALID_EXPR) The specified expression is invalid, and could not be parsed.
36  
37 210 (CODE_OK) The expression has been accepted and will be used to limit the results returned from QUER.
38  
39 =cut
40  
41  
42 40 my $c = 'EXPR';
43  
44 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
45 7 my ( $class, %options ) = @_;
46  
47 7 my $self = bless \%options, $class;
48 7 return $self;
49 }
50  
51 16 ▶sub as_string {
Subroutine as_string: called CC=3 SCAR=11.0
Pod documented
52 16 my ($self) = @_;
53 16 ▶ return undef if not defined $self->{expressions};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"expressions"} 2 14 16
54 14 ▶ return undef if ref( $self->{expressions} ) ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"expressions"} ne "ARRAY" 0 14 14
55 14 return $c . ' ' . join( ' & ', @{$self->{expressions}} );
56 }
57  
58 7 ▶sub is_ok {
Subroutine is_ok: called CC=4 SCAR=13.9
Pod undocumented
59 7 my ($self) = @_;
60 7 ▶ return 0 if not defined $self->response;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response 1 6 7
61 6 ▶ return 0 if not defined $self->response->code;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response->code 0 6 6
62 6 ▶ return 1 if $self->response->code == CODE_OK;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code == 210 5 1 6
63 1 return 0;
64 }
65  
66 40 1;
« Gnats/Command/USER.pm ↑ Summary Gnats/Field.pm »