| 1 | package Net::Gnats::Command::FDSC; | ||||||||||||||||||||||||||||
| 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::FDSC::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::FDSC | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | Returns a human-readable description of the listed field(s). The possible responses are: | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | Like the FVLD command, the standard continuation protocol will be | ||||||||||||||||||||||||||||
| 20 | used if multiple fields were specified with the command. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head1 PROTOCOL | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | FDSC [fields...] | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =head1 RESPONSES | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 350 (CODE_INFORMATION) | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | The normal response; the supplied text is the field description. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 410 (CODE_INVALID_FIELD_NAME) | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | The specified field does not exist. | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =cut | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 40 | my $c = 'FDSC'; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 41 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 41 | 41 | my ( $class, %options ) = @_; | |||||||||||||||||||||||||||
| 42 | 41 | my $self = bless \%options, $class; | |||||||||||||||||||||||||||
| 43 | 41 | $self->{requests_multi} = 0; | |||||||||||||||||||||||||||
| 44 | 41 | ▶ | return $self if not defined $self->{fields}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 40 | ▶ | if (ref $self->{fields} eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 40 | ▶ | $self->{requests_multi} = 1 if scalar @{ $self->{fields} } > 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | else { | ||||||||||||||||||||||||||||
| 49 | 0 | $self->{fields} = [ $self->{fields} ]; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 40 | return $self; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 88 | ▶ | sub as_string { | ||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 55 | 88 | my ($self) = @_; | |||||||||||||||||||||||||||
| 56 | 88 | ▶ | return undef if not defined $self->{fields}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 86 | ▶ | return undef if ref $self->{fields} ne 'ARRAY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 86 | ▶ | return undef if scalar @{ $self->{fields} } == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 86 | return $c . ' ' . join ( ' ', @{$self->{fields}} ); | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | # this command can take multiple fields, each getting their own response. | ||||||||||||||||||||||||||||
| 63 | # so, we check that 'everything' is okay by looking at the parent response. | ||||||||||||||||||||||||||||
| 64 | 3 | ▶ | sub is_ok { | ||||||||||||||||||||||||||
|
Subroutine
is_ok: called CC=5 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 65 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 66 | 3 | ▶ | return 0 if not defined $self->response; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | 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
| |||||||||||||||||||||||||||||
| 68 | $self->response->code == CODE_INFORMATION) { | ||||||||||||||||||||||||||||
| 69 | 1 | return 1; | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | 1 | ▶ | return 1 if $self->response->code == CODE_INFORMATION; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 0 | return 0; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 40 | 1; | |||||||||||||||||||||||||||