| 1 | package Net::Gnats::Command::QUER; | ||||||||||
| 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::QUER::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_PR_READY CODE_INVALID_QUERY_FORMAT CODE_NO_PRS_MATCHED); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | =head1 NAME | ||||||||||
| 12 | |||||||||||
| 13 | Net::Gnats::Command::QUER | ||||||||||
| 14 | |||||||||||
| 15 | =head1 DESCRIPTION | ||||||||||
| 16 | |||||||||||
| 17 | Searches the contents of the database for PRs that match the | ||||||||||
| 18 | (optional) specified expressions with the EXPR command. If no | ||||||||||
| 19 | expressions were specified with EXPR, the entire set of PRs is | ||||||||||
| 20 | returned. | ||||||||||
| 21 | |||||||||||
| 22 | If one or more PRs are specified on the command line, only those PRs | ||||||||||
| 23 | will be searched and/or output. | ||||||||||
| 24 | |||||||||||
| 25 | The format of the output from the command is determined by the query | ||||||||||
| 26 | format selected with the QFMT command. | ||||||||||
| 27 | |||||||||||
| 28 | =head1 PROTOCOL | ||||||||||
| 29 | |||||||||||
| 30 | QUER [pr...] | ||||||||||
| 31 | |||||||||||
| 32 | =head1 RESPONSES | ||||||||||
| 33 | |||||||||||
| 34 | The possible responses are: | ||||||||||
| 35 | |||||||||||
| 36 | 418 (CODE_INVALID_QUERY_FORMAT) | ||||||||||
| 37 | A valid format was not specified with the QFMT command prior to invoking QUER. | ||||||||||
| 38 | |||||||||||
| 39 | 300 (CODE_PR_READY) One or more PRs will be output using the | ||||||||||
| 40 | requested query format. The PR text is quoted using the normal | ||||||||||
| 41 | quoting mechanisms for PRs. | ||||||||||
| 42 | |||||||||||
| 43 | 220 (CODE_NO_PRS_MATCHED) No PRs met the specified criteria. | ||||||||||
| 44 | |||||||||||
| 45 | =cut | ||||||||||
| 46 | |||||||||||
| 47 | 40 | my $c = 'QUER'; | |||||||||
| 48 | |||||||||||
| 49 | 15 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 50 | 15 | my ( $class, %options ) = @_; | |||||||||
| 51 | |||||||||||
| 52 | 15 | my $self = bless \%options, $class; | |||||||||
| 53 | 15 | ▶ | $self->{pr_numbers} = [] if not defined $self->{pr_numbers}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 15 | return $self; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 27 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 58 | 27 | my $self = shift; | |||||||||
| 59 | 16 | return $c . ' ' . join ' ', @{ $self->{pr_numbers}} | |||||||||
| 60 | 27 | ▶ | if ( scalar @{$self->{pr_numbers}} != 0); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 11 | return $c; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 5 | ▶ | sub is_ok { | ||||||||
|
Subroutine
is_ok: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 65 | 5 | my $self = shift; | |||||||||
| 66 | 5 | ▶ | return 1 if $self->response->code == CODE_PR_READY; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 67 | 2 | return 0; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 40 | 1; | |||||||||