File Coverage

blib/lib/App/bif/drop/change.pm
Criterion Covered Total %
statement 12 23 52.1
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 31 54.8


line stmt bran cond sub pod time code
1             package App::bif::drop::change;
2 1     1   3990 use strict;
  1         2  
  1         25  
3 1     1   5 use warnings;
  1         3  
  1         33  
4 1     1   5 use Bif::Mo;
  1         2  
  1         7  
5              
6             our $VERSION = '0.1.5_6';
7             extends 'App::bif';
8              
9             sub run {
10 1     1 1 2 my $self = shift;
11 1         4 my $opts = $self->opts;
12 1         6 my $dbw = $self->dbw;
13 0           my $info = $self->get_change( $opts->{uid} );
14              
15 0 0         if ( !$opts->{force} ) {
16 0           print "Nothing dropped (missing --force, -f)\n";
17 0           return $self->ok('DropNoForce');
18             }
19              
20 0           my $uuid = substr( $info->{uuid}, 0, 8 );
21              
22             $dbw->txn(
23             sub {
24 0     0     $self->start_work(
25             start => time,
26             start_comment => "drop change c$info->{id} <$uuid>",
27             billable => 0,
28             save => 1,
29             );
30              
31             $dbw->xdo(
32             delete_from => 'changes',
33             where => { id => $info->{id} },
34 0           );
35              
36 0           print "Change dropped: c$info->{id} <$uuid>\n";
37              
38 0           $self->stop_work(
39             stop => time,
40             restore => 1,
41             );
42             }
43 0           );
44              
45 0           return $self->ok('DropChange');
46             }
47              
48             1;
49             __END__