| 1 | package Net::Gnats::Command::APPN; | ||||||||||
| 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::APPN::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_SEND_TEXT CODE_OK CODE_NONEXISTENT_PR CODE_INVALID_FIELD_NAME | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | CODE_UNREADABLE_PR CODE_GNATS_LOCKED CODE_LOCKED_PR | ||||||||||
| 11 | 40 | CODE_INVALID_FIELD_CONTENTS); | |||||||||
| 12 | |||||||||||
| 13 | =head1 NAME | ||||||||||
| 14 | |||||||||||
| 15 | Net::Gnats::Command::APPN | ||||||||||
| 16 | |||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||
| 18 | |||||||||||
| 19 | The APPN command appends to the contents of field in PR with the supplied | ||||||||||
| 20 | text. | ||||||||||
| 21 | |||||||||||
| 22 | When first issued, it returns a 212 (CODE_SEND_TEXT). The client | ||||||||||
| 23 | should then transmit the new field contents using the standard PR | ||||||||||
| 24 | quoting mechanism. After the server has read the new contents, it then | ||||||||||
| 25 | attempts to make the requested change to the PR. | ||||||||||
| 26 | |||||||||||
| 27 | The command returns a 210 (CODE_OK) when it does not require a Change Reason. | ||||||||||
| 28 | |||||||||||
| 29 | When the command returns a 213 () it expects a Change Reason. The | ||||||||||
| 30 | Change Reason is a multiText value. After successful submit of the | ||||||||||
| 31 | Change Reason, it returns a 210 (CODE_OK). | ||||||||||
| 32 | |||||||||||
| 33 | =head1 PROTOCOL | ||||||||||
| 34 | |||||||||||
| 35 | When making a change that does not require a change reason: | ||||||||||
| 36 | |||||||||||
| 37 | APPN <pr> <field> | ||||||||||
| 38 | <-- 212 | ||||||||||
| 39 | <change> | ||||||||||
| 40 | <-- 210 | ||||||||||
| 41 | |||||||||||
| 42 | When making a change that requires a change reason: | ||||||||||
| 43 | |||||||||||
| 44 | APPN <pr> <field> | ||||||||||
| 45 | <-- 212 | ||||||||||
| 46 | <change> | ||||||||||
| 47 | <-- 213 | ||||||||||
| 48 | <change reason> | ||||||||||
| 49 | <-- 210 | ||||||||||
| 50 | |||||||||||
| 51 | =head1 RESPONSES | ||||||||||
| 52 | |||||||||||
| 53 | The possible responses are: | ||||||||||
| 54 | |||||||||||
| 55 | 210 (CODE_OK) The PR field was successfully changed. | ||||||||||
| 56 | |||||||||||
| 57 | 400 (CODE_NONEXISTENT_PR) The PR specified does not exist. | ||||||||||
| 58 | |||||||||||
| 59 | 410 (CODE_INVALID_FIELD_NAME) The specified field does not exist. | ||||||||||
| 60 | |||||||||||
| 61 | 402 (CODE_UNREADABLE_PR) The PR could not be read. | ||||||||||
| 62 | |||||||||||
| 63 | 431 (CODE_GNATS_LOCKED) The database has been locked, and no PRs may | ||||||||||
| 64 | be updated until the lock is cleared. | ||||||||||
| 65 | |||||||||||
| 66 | 430 (CODE_LOCKED_PR) The PR is locked, and may not be altered until | ||||||||||
| 67 | the lock is cleared. | ||||||||||
| 68 | |||||||||||
| 69 | 413 (CODE_INVALID_FIELD_CONTENTS) The supplied (or resulting) field | ||||||||||
| 70 | contents are not valid for the field. | ||||||||||
| 71 | |||||||||||
| 72 | 6xx (internal error) An internal error occurred, usually because of | ||||||||||
| 73 | permission or other filesystem-related problems. The PR may or may | ||||||||||
| 74 | not have been altered. | ||||||||||
| 75 | |||||||||||
| 76 | =cut | ||||||||||
| 77 | |||||||||||
| 78 | 40 | my $c = 'APPN'; | |||||||||
| 79 | |||||||||||
| 80 | 4 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 81 | 4 | my ( $class, %options ) = @_; | |||||||||
| 82 | |||||||||||
| 83 | 4 | my $self = bless \%options, $class; | |||||||||
| 84 | 4 | return $self; | |||||||||
| 85 | } | ||||||||||
| 86 | |||||||||||
| 87 | # Actually two commands, send this first and then the contents of the | ||||||||||
| 88 | # field. | ||||||||||
| 89 | 5 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 90 | 5 | my ($self) = @_; | |||||||||
| 91 | 5 | ▶ | return undef if not defined $self->{pr_number}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 92 | 3 | ▶ | return undef if not defined $self->{field}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 93 | 2 | return $c . ' ' . $self->{pr_number} . ' ' . $self->{field}->name; | |||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 4 | ▶ | sub is_ok { | ||||||||
|
Subroutine
is_ok: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||
| 97 | 4 | my ($self) = @_; | |||||||||
| 98 | 4 | ▶ | return 0 if not defined $self->response; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 99 | 1 | ▶ | return 1 if $self->response->code == CODE_OK; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 100 | 0 | return 0; | |||||||||
| 101 | } | ||||||||||
| 102 | |||||||||||
| 103 | 40 | 1; | |||||||||