BlankOnDev/system.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 74 CC 7 SCAR 35.1
CC
7
Cov
0%
kill_exists_ps
56.0
BEGIN
2.0
BEGIN
2.0
CRAP 33.5
1 package BlankOnDev::system;
2 use strict;
3 use warnings FATAL => 'all';
4  
5 # Import :
6 use Data::Dumper;
7 use BlankOnDev::DateTime;
8 use List::Util qw(max);
9  
10 # Version :
11 our $VERSION = '0.1005';
12  
13 # Subroutine for kill exists process :
14 # ------------------------------------------------------------------------
15 sub kill_exists_ps {
16 my ($self, $gencfg) = @_;
17 my $form_confirm;
18 my $curr_timezone = exists $gencfg->{'timezone'} && $gencfg->{'timezone'} ne '' ? $gencfg->{'timezone'} : 'Asia/Makassar';
19 my $timestamp = time();
20 my $get_dataTime = BlankOnDev::DateTime->get($curr_timezone, $timestamp, {
21 'date' => '-',
22 'time' => ':',
23 'datetime' => ' ',
24 'format' => 'DD-MM-YYYY hms'
25 });
26 my $get_time = $get_dataTime->{'time'};
27 my $hour_time = $get_time->{hour};
28 my $minutes_time = $get_time->{minute};
29 $minutes_time = length $minutes_time == 1 ? '0'.$get_time->{minute} : $get_time->{minute};
30 my $time_proccess = "$hour_time:$minutes_time";
31 my @ps_list = ();
32 my @processes = `ps -ef | grep boidev`;
33 @processes = grep(!/grep/, @processes);
34 # @processes = grep(!/$time_proccess/, @processes);
35 @processes = grep($_ =~ s/\n//g, @processes);
36 foreach my $line (@processes)
37 {
38 if ($line =~ /boidev/) {
39 my @list = split(/\s+/, $line);
40 push(@ps_list, $list[1]);
41 }
42 }
43 my $curr_pid = max(@ps_list);
44 @ps_list = grep(!/$curr_pid/,@ps_list);
45  
46 # From Confirm :
47 if (scalar(@ps_list) > 0) {
48 print "\n";
49 print ("There are ", scalar(@ps_list), " boidev is active process. \n");
50 print "Do you want to kill that process ? [y or n] ";
51 chomp($form_confirm = <STDIN>);
52 if ($form_confirm eq 'y' or $form_confirm eq 'Y') {
53 kill(9, @ps_list) if (scalar(@ps_list) > 0);
54 print ("Kill exists process before : ", scalar(@ps_list));
55 }
56 }
57 }
58 1;