Gnats/Command/UNLK.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 97.6% 41 / 42 CC 4 SCAR 5.5
CC
4
Cov
100%
is_ok
3.0
as_string
2.0
BEGIN
1.0
CRAP 1.7
« Gnats/Command/VFLD.pm ↑ Summary Gnats/Command.pm »
1 package Net::Gnats::Command::UNLK;
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::UNLK::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_OK CODE_PR_NOT_LOCKED);
Subroutine BEGIN: called CC=1 SCAR=0.0
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 <PR number>
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 40 my $c = 'UNLK';
50  
51 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
52 4 my ( $class, %options ) = @_;
53 4 my $self = bless \%options, $class;
54 4 return $self;
55 }
56  
57 11 ▶sub as_string {
Subroutine as_string: called CC=2 SCAR=6.9
Pod documented
58 11 my $self = shift;
59 11 ▶ return undef if not defined $self->{pr_number};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"pr_number"} 1 10 11
60 10 return $c . ' ' . $self->{pr_number};
61 }
62  
63 6 ▶sub is_ok {
Subroutine is_ok: called CC=3 SCAR=11.0
Pod undocumented
64 6 my $self = shift;
65 6 ▶ return 0 if not defined $self->response;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->response 1 5 6
66 5 ▶ return 1 if $self->response->code == CODE_OK;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code == 210 3 2 5
67 2 return 0;
68 }
69  
70 40 1;
« Gnats/Command/VFLD.pm ↑ Summary Gnats/Command.pm »