| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::Gnats::Command::EDITADDR; | 
| 2 | 40 |  |  | 40 |  | 180 | use parent 'Net::Gnats::Command'; | 
|  | 40 |  |  |  |  | 62 |  | 
|  | 40 |  |  |  |  | 194 |  | 
| 3 | 40 |  |  | 40 |  | 10068 | use strictures; | 
|  | 40 |  |  |  |  | 68 |  | 
|  | 40 |  |  |  |  | 188 |  | 
| 4 |  |  |  |  |  |  | BEGIN { | 
| 5 | 40 |  |  | 40 |  | 3382 | $Net::Gnats::Command::EDITADDR::VERSION = '0.21'; | 
| 6 |  |  |  |  |  |  | } | 
| 7 | 40 |  |  | 40 |  | 200 | use vars qw($VERSION); | 
|  | 40 |  |  |  |  | 63 |  | 
|  | 40 |  |  |  |  | 1721 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 40 |  |  | 40 |  | 196 | use Net::Gnats::Constants qw(CODE_OK CODE_CMD_ERROR); | 
|  | 40 |  |  |  |  | 56 |  | 
|  | 40 |  |  |  |  | 8215 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =head1 NAME | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | Net::Gnats::Command::EDITADDR | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | Sets the e-mail address of the person communicating with gnatsd. The | 
| 18 |  |  |  |  |  |  | command requires at least the edit access level. | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | =head1 PROTOCOL | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | EDITADDR [address] | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | =head1 RESPONSES | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | The possible responses are: | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | 200 (CODE_OK) | 
| 29 |  |  |  |  |  |  | The address was successfully set. | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | 440 (CODE_CMD_ERROR) | 
| 32 |  |  |  |  |  |  | Invalid number of arguments were supplied. | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | =cut | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | my $c = 'EDITADDR'; | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub new { | 
| 40 | 4 |  |  | 4 | 1 | 12 | my ( $class, %options ) = @_; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 4 |  |  |  |  | 10 | my $self = bless \%options, $class; | 
| 43 | 4 |  |  |  |  | 12 | return $self; | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | sub as_string { | 
| 47 | 7 |  |  | 7 | 1 | 9 | my ($self) = @_; | 
| 48 | 7 | 100 |  |  |  | 40 | return undef if not defined $self->{address}; | 
| 49 | 6 |  |  |  |  | 24 | return $c . ' ' . $self->{address}; | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | sub is_ok { | 
| 53 | 4 |  |  | 4 | 0 | 7 | my ($self) = @_; | 
| 54 |  |  |  |  |  |  | # command not issued | 
| 55 | 4 | 100 |  |  |  | 11 | return 0 if not defined $self->response; | 
| 56 |  |  |  |  |  |  | # malformed command | 
| 57 | 3 | 50 |  |  |  | 8 | return 0 if not defined $self->response->code; | 
| 58 | 3 | 50 |  |  |  | 9 | return 1 if $self->response->code == CODE_OK; | 
| 59 | 0 |  |  |  |  |  | return 0; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | 1; |