| 1 | package Net::Gnats::Command::FTYP; | ||||||||||||||||||||||||||||
| 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::FTYP::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::FTYP | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | Describes the type of data held in the field(s) specified with the | ||||||||||||||||||||||||||||
| 18 | command. | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | If multiple field names were given, multiple response lines will be | ||||||||||||||||||||||||||||
| 21 | sent, one for each field, using the standard continuation protocol; | ||||||||||||||||||||||||||||
| 22 | each response except the last will have a dash - immedately after | ||||||||||||||||||||||||||||
| 23 | the response code. | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | The currently defined data types are: | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | Text | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | A plain text field, containing exactly one line. | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | MultiText | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | A text field possibly containing multiple lines of text. | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | Enum | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | An enumerated data field; the value is restricted to one entry out | ||||||||||||||||||||||||||||
| 38 | of a list of values associated with the field. | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | MultiEnum | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | The field contains one or more enumerated values. Values are | ||||||||||||||||||||||||||||
| 43 | separated with spaces or colons :. | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | Integer | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | The field contains an integer value, possibly signed. | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | Date | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | The field contains a date. | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | TextWithRegex | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | The value in the field must match one or more regular expressions | ||||||||||||||||||||||||||||
| 56 | associated with the field. | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =head1 PROTOCOL | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | FTYP [fields...] | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =head1 RESPONSES | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | The possible responses are: | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 350 (CODE_INFORMATION) | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | The normal response; the supplied text is the data type. | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 410 (CODE_INVALID_FIELD_NAME) | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | The specified field does not exist. | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =cut | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 40 | my $c = 'FTYP'; | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 46 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 80 | 46 | my ( $class, %options ) = @_; | |||||||||||||||||||||||||||
| 81 | 46 | my $self = bless \%options, $class; | |||||||||||||||||||||||||||
| 82 | 46 | $self->{requests_multi} = 0; | |||||||||||||||||||||||||||
| 83 | 46 | ▶ | return $self if not defined $self->{fields}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 45 | ▶ | if (ref $self->{fields} eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | 42 | ▶ | $self->{requests_multi} = 1 if scalar @{ $self->{fields} } > 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | else { | ||||||||||||||||||||||||||||
| 89 | 3 | $self->{fields} = [ $self->{fields} ]; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | 45 | return $self; | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 97 | ▶ | sub as_string { | ||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 95 | 97 | my ($self) = @_; | |||||||||||||||||||||||||||
| 96 | 97 | ▶ | return undef if not defined $self->{fields}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | 96 | return $c . ' ' . join ( ' ', @{$self->{fields}} ); | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | # this command can take multiple fields, each getting their own response. | ||||||||||||||||||||||||||||
| 101 | # so, we check that 'everything' is okay by looking at the parent response. | ||||||||||||||||||||||||||||
| 102 | 8 | ▶ | sub is_ok { | ||||||||||||||||||||||||||
|
Subroutine
is_ok: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 103 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 104 | 8 | ▶ | return 0 if not defined $self->response; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | 7 | ▶ | return 0 if not defined $self->response->code; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 7 | ▶ | if ( $self->{requests_multi} == 0 and | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"requests_multi"} == 0 and $self->response->code == 350
MC/DC100%2/2
$self->{"requests_multi"} == 0 and $self->response->code == 350
$self->{"requests_multi"} == 0
$self->response->code == 350
Truth table100%3/3
A and B
A= $self->{"requests_multi"} == 0B= $self->response->code == 350
| |||||||||||||||||||||||||||||
| 108 | $self->response->code == CODE_INFORMATION) { | ||||||||||||||||||||||||||||
| 109 | 4 | return 1; | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | 3 | ▶ | return 1 if $self->response->code == CODE_INFORMATION; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 1 | return 0; | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 40 | 1; | |||||||||||||||||||||||||||