| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::Gnats::Command::EXPR; | 
| 2 | 40 |  |  | 40 |  | 185 | use parent 'Net::Gnats::Command'; | 
|  | 40 |  |  |  |  | 58 |  | 
|  | 40 |  |  |  |  | 333 |  | 
| 3 | 40 |  |  | 40 |  | 2314 | use strictures; | 
|  | 40 |  |  |  |  | 70 |  | 
|  | 40 |  |  |  |  | 191 |  | 
| 4 |  |  |  |  |  |  | BEGIN { | 
| 5 | 40 |  |  | 40 |  | 3374 | $Net::Gnats::Command::EXPR::VERSION = '0.21'; | 
| 6 |  |  |  |  |  |  | } | 
| 7 | 40 |  |  | 40 |  | 241 | use vars qw($VERSION); | 
|  | 40 |  |  |  |  | 66 |  | 
|  | 40 |  |  |  |  | 1744 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 40 |  |  | 40 |  | 204 | use Net::Gnats::Constants qw(CODE_OK CODE_INVALID_EXPR); | 
|  | 40 |  |  |  |  | 66 |  | 
|  | 40 |  |  |  |  | 9796 |  | 
| 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 |  |  |  |  |  |  | my $c = 'EXPR'; | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | sub new { | 
| 45 | 7 |  |  | 7 | 1 | 21 | my ( $class, %options ) = @_; | 
| 46 |  |  |  |  |  |  |  | 
| 47 | 7 |  |  |  |  | 31 | my $self = bless \%options, $class; | 
| 48 | 7 |  |  |  |  | 31 | return $self; | 
| 49 |  |  |  |  |  |  | } | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | sub as_string { | 
| 52 | 16 |  |  | 16 | 1 | 28 | my ($self) = @_; | 
| 53 | 16 | 100 |  |  |  | 82 | return undef if not defined $self->{expressions}; | 
| 54 | 14 | 50 |  |  |  | 47 | return undef if ref( $self->{expressions} ) ne 'ARRAY'; | 
| 55 | 14 |  |  |  |  | 26 | return $c . ' ' . join( ' & ', @{$self->{expressions}} ); | 
|  | 14 |  |  |  |  | 98 |  | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | sub is_ok { | 
| 59 | 7 |  |  | 7 | 0 | 13 | my ($self) = @_; | 
| 60 | 7 | 100 |  |  |  | 25 | return 0 if not defined $self->response; | 
| 61 | 6 | 50 |  |  |  | 19 | return 0 if not defined $self->response->code; | 
| 62 | 6 | 100 |  |  |  | 22 | return 1 if $self->response->code == CODE_OK; | 
| 63 | 1 |  |  |  |  | 9 | return 0; | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | 1; |