| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::Gnats::Command::UNLK; | 
| 2 | 40 |  |  | 40 |  | 207 | use parent 'Net::Gnats::Command'; | 
|  | 40 |  |  |  |  | 70 |  | 
|  | 40 |  |  |  |  | 221 |  | 
| 3 | 40 |  |  | 40 |  | 2264 | use strictures; | 
|  | 40 |  |  |  |  | 73 |  | 
|  | 40 |  |  |  |  | 208 |  | 
| 4 |  |  |  |  |  |  | BEGIN { | 
| 5 | 40 |  |  | 40 |  | 9127 | $Net::Gnats::Command::UNLK::VERSION = '0.22'; | 
| 6 |  |  |  |  |  |  | } | 
| 7 | 40 |  |  | 40 |  | 194 | use vars qw($VERSION); | 
|  | 40 |  |  |  |  | 70 |  | 
|  | 40 |  |  |  |  | 1511 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 40 |  |  | 40 |  | 206 | use Net::Gnats::Constants qw(CODE_OK CODE_PR_NOT_LOCKED); | 
|  | 40 |  |  |  |  | 76 |  | 
|  | 40 |  |  |  |  | 8848 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =head1 NAME | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | Net::Gnats::Command::UNLK | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | Unlocks PR. Any user may unlock a PR, as no checking is done to | 
| 19 |  |  |  |  |  |  | determine if the requesting session owns the lock. | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =head1 PROTOCOL | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | UNLK | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =head1 RESPONSES | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | The possible responses are: | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | 440 (CODE_CMD_ERROR) | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | Insufficient or too many arguments were specified to the command. | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | 210 (CODE_OK) | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | The PR was successfully unlocked. | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | 433 (CODE_PR_NOT_LOCKED) | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | The PR was not locked. | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | 6xx (internal error) | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | The PR could not be unlocked, usually because of permission or other | 
| 45 |  |  |  |  |  |  | filesystem-related problems. | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =cut | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | my $c = 'UNLK'; | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | sub new { | 
| 52 | 4 |  |  | 4 | 1 | 13 | my ( $class, %options ) = @_; | 
| 53 | 4 |  |  |  |  | 9 | my $self = bless \%options, $class; | 
| 54 | 4 |  |  |  |  | 13 | return $self; | 
| 55 |  |  |  |  |  |  | } | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | sub as_string { | 
| 58 | 11 |  |  | 11 | 1 | 14 | my $self = shift; | 
| 59 | 11 | 100 |  |  |  | 44 | return undef if not defined $self->{pr_number}; | 
| 60 | 10 |  |  |  |  | 40 | return $c . ' ' . $self->{pr_number}; | 
| 61 |  |  |  |  |  |  | } | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | sub is_ok { | 
| 64 | 6 |  |  | 6 | 0 | 12 | my $self = shift; | 
| 65 | 6 | 100 |  |  |  | 18 | return 0 if not defined $self->response; | 
| 66 | 5 | 100 |  |  |  | 16 | return 1 if $self->response->code == CODE_OK; | 
| 67 | 2 |  |  |  |  | 10 | return 0; | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | 1; |