| 1 | package Net::Gnats::Command::FIELDFLAGS; | ||||||||||||||||||||||||||||
| 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::FIELDFLAGS::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_FIELD_NAME); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =head1 NAME | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | Net::Gnats::Command::FIELDFLAGS | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | Returns a set of flags describing the specified field(s). | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | Like the FDSC and FTYP commands, multiple field names may be listed | ||||||||||||||||||||||||||||
| 20 | with the command, and a response line will be returned for each one | ||||||||||||||||||||||||||||
| 21 | in the order that the fields appear on the command line. | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | The flags include: | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | textsearch | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | The field will be searched when a text field search is requested. | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | allowAnyValue | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | For fields that contain enumerated values, any legal value may be | ||||||||||||||||||||||||||||
| 32 | used in the field, not just ones that appear in the enumerated list. | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | requireChangeReason | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | If the field is edited, a reason for the change must be supplied in | ||||||||||||||||||||||||||||
| 37 | the new PR text describing the reason for the change. The reason | ||||||||||||||||||||||||||||
| 38 | must be supplied as a multitext PR field in the new PR whose name is | ||||||||||||||||||||||||||||
| 39 | field-Changed-Why (where field is the name of the field being | ||||||||||||||||||||||||||||
| 40 | edited). | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | readonly | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | The field is read-only, and cannot be edited. | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =head1 PROTOCOL | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | FIELDFLAGS [fields...] | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =head1 RESPONSES | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 410 (CODE_INVALID_FIELD_NAME) | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | meaning that the specified field is invalid or nonexistent, or | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 350 (CODE_INFORMATION) | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | which contains the set of flags for the field. The flags may be | ||||||||||||||||||||||||||||
| 59 | blank, which indicate that no special flags have been set for this | ||||||||||||||||||||||||||||
| 60 | field. | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =cut | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 40 | my $c = 'FIELDFLAGS'; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 41 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 67 | 41 | my ( $class, %options ) = @_; | |||||||||||||||||||||||||||
| 68 | 41 | my $self = bless \%options, $class; | |||||||||||||||||||||||||||
| 69 | 41 | $self->{requests_multi} = 0; | |||||||||||||||||||||||||||
| 70 | 41 | ▶ | return $self if not defined $self->{fields}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 40 | ▶ | if (ref $self->{fields} eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 40 | ▶ | $self->{requests_multi} = 1 if scalar @{ $self->{fields} } > 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | else { | ||||||||||||||||||||||||||||
| 76 | 0 | $self->{fields} = [ $self->{fields} ]; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | 40 | return $self; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 81 | ▶ | sub as_string { | ||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 82 | 81 | my ($self) = @_; | |||||||||||||||||||||||||||
| 83 | 81 | ▶ | return undef if not defined $self->{fields}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 80 | ▶ | return undef if ref $self->{fields} ne 'ARRAY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | 80 | ▶ | return undef if scalar @{ $self->{fields} } == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | 80 | return $c . ' ' . join ( ' ', @{$self->{fields}} ); | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | # this command can take multiple fields, each getting their own response. | ||||||||||||||||||||||||||||
| 90 | # so, we check that 'everything' is okay by looking at the parent response. | ||||||||||||||||||||||||||||
| 91 | 3 | ▶ | sub is_ok { | ||||||||||||||||||||||||||
|
Subroutine
is_ok: called CC=5 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 92 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 93 | 3 | ▶ | return 0 if not defined $self->response; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 2 | ▶ | if ( $self->{requests_multi} == 0 and | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"requests_multi"} == 0 and $self->response->code == 350
MC/DC50%1/2
$self->{"requests_multi"} == 0 and $self->response->code == 350
$self->{"requests_multi"} == 0
$self->response->code == 350
Truth table66%2/3
A and B
A= $self->{"requests_multi"} == 0B= $self->response->code == 350
| |||||||||||||||||||||||||||||
| 96 | $self->response->code == CODE_INFORMATION) { | ||||||||||||||||||||||||||||
| 97 | 1 | return 1; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | 1 | ▶ | return 1 if $self->response->code == CODE_INFORMATION; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | 0 | return 0; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 40 | 1; | |||||||||||||||||||||||||||