Gnats/Command/DELETE.pm

filter: Statementstmt 95.6% 22 / 23 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 91.6% 33 / 36 CC 2 SCAR 2.5
CC
2
Cov
92%
is_ok
2.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Gnats/Command/DBLS.pm ↑ Summary Gnats/Command/LKDB.pm »
1 package Net::Gnats::Command::DELETE;
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::DELETE::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_NO_ACCESS CODE_LOCKED_PR CODE_GNATS_LOCKED);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Net::Gnats::Command::DELETE
14  
15 =head1 DESCRIPTION
16  
17 Deletes the specified PR. The user making the request must have
18 admin privileges (see Controlling access to databases). If
19 successful, the PR is removed from the filesystem and the index
20 file; a gap will be left in the numbering sequence for PRs. No
21 checks are made that the PR is closed.
22  
23 =head1 PROTOCOL
24  
25 DELETE [PR NUMBER]
26  
27 =head1 RESPONSES
28  
29 The possible responses are:
30  
31 210 (CODE_OK)
32  
33 The PR was successfully deleted.
34  
35 422 (CODE_NO_ACCESS)
36  
37 The user requesting the delete does not have admin privileges.
38  
39 430 (CODE_LOCKED_PR)
40  
41 The PR is locked by another session.
42  
43 431 (CODE_GNATS_LOCKED)
44  
45 The database has been locked, and no PRs may be updated until the
46 lock is cleared.
47  
48 6xx (internal error)
49  
50 The PR could not be successfully deleted, usually because of
51 permission or other filesystem-related problems.
52  
53 =cut
54  
55 40 my $c = 'DELETE';
56  
57 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
58 1 my ( $class, %options ) = @_;
59  
60 1 my $self = bless \%options, $class;
61 1 return $self;
62 }
63  
64 2 ▶sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
65 2 my $self = shift;
66 2 return $c . ' ' . $self->{pr_number};
67 }
68  
69 1 ▶sub is_ok {
Subroutine is_ok: called CC=2 SCAR=8.1
Pod undocumented
70 1 my $self = shift;
71 1 ▶ return 1 if $self->response->code == CODE_OK;
Branch: 1 branch
BranchTrueFalseTotal
if $self->response->code == 210 1 0 1
72 0 return 0;
73 }
74  
75 40 1;
« Gnats/Command/DBLS.pm ↑ Summary Gnats/Command/LKDB.pm »