BlankOnDev/Form.pm

filter: Statementstmt 12.2% 17 / 139 Branchbran 0.0% 0 / 40 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 45.4% 5 / 11 Podpod 0.0% 0 / 6 totaltotal 10.6% 22 / 206 CC 23 SCAR 31.8
CC
23
Cov
9%
form_timezone
42.0
form_email_git
30.0
form_email_gpg
30.0
CRAP 24.2
« BlankOnDev/Form/github.pm ↑ Summary BlankOnDev/syslog.pm »
1 package BlankOnDev::Form;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # Import :
6 1 ▶use Term::ReadKey;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use BlankOnDev::Rilis;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use BlankOnDev::DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # Version :
11 1 our $VERSION = '0.1005';
12  
13 # Subroutine for form time zone :
14 # ------------------------------------------------------------------------
15 0 ▶sub form_timezone {
Subroutine form_timezone: not called CC=6 SCAR=37.4
Pod undocumented
16 0 my ($self, $time_zone) = @_;
17 # Prepare From TimeZone :
18 0 my $form_timezone;
19 0 ▶ my $timezone = $time_zone ? $time_zone : 'Asia/Makassar';
Branch: 1 branch
BranchTrueFalseTotal
$time_zone ? : 0 0 0
20 0 my $data_timezone = '';
21 0 my $id_timezone = BlankOnDev::DateTime::id_timezone();
22 0 my $tz_long_short = $id_timezone->{'long-short'};
23 0 my $tz_num_short = $id_timezone->{'num-short'};
24 0 my $tz_num_long = $id_timezone->{'num-long'};
25 0 ▶ if (exists $tz_long_short->{$timezone}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tz_long_short->{$timezone}) { } 0 0 0
26 0 $timezone = uc $tz_long_short->{$timezone}
27 } else {
28 0 $timezone = $timezone;
29 }
30  
31 0 print "\n";
32 0 print "List TimeZone : \n";
33 0 print "1. WIB \n";
34 0 print "2. WITA \n";
35 0 print "3. WIT \n";
36 0 ▶ if ($timezone ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($timezone ne '') { } 0 0 0
37 0 print "Enter your time zone [$timezone] : ";
38 } else {
39 0 print "Enter your time zone : ";
40 }
41 0 chomp($form_timezone = <STDIN>);
42 0 ▶ if ($form_timezone ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($form_timezone ne '') { } 0 0 0
43 0 ▶ if ($form_timezone =~ m/^[0-9]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($form_timezone =~ /^[0-9]$/) { } 0 0 0
44 0 $data_timezone = $tz_num_long->{$form_timezone};
45 } else {
46 0 $data_timezone = $tz_num_long->{'1'};
47 }
48 } else {
49 0 $data_timezone = 'Asia/Makassar';
50 }
51 0 print "\n";
52 0 print "Active TimeZone : $data_timezone\n";
53 0 return $data_timezone;
54 }
55 # Subroutine for form blankon release :
56 # ------------------------------------------------------------------------
57 0 ▶sub form_boi_rilis {
Subroutine form_boi_rilis: not called CC=4 SCAR=30.0
Pod undocumented
58 0 my ($self) = @_;
59 # Prepare Form Rilis :
60 0 my $num_data_rilis;
61 0 my %data = ();
62 0 my $data_rilis = BlankOnDev::Rilis::data();
63 0 my $latest_rilis = $data_rilis->{'latest'}->{'name'};
64 0 my $boi_rilis = $latest_rilis;
65 0 my $status = 0;
66  
67 0 print "\n";
68 0 print "Choose rilis \n";
69 0 print "---" x 15 . "\n";
70 # my $daftar_rilis = list_rilis();
71 # my $num = 0;
72 # my %choose_rilis = ();
73 # while (my ($key, $value) = each %{$daftar_rilis}) {
74 # my $num_rilis = $num + 1;
75 # $choose_rilis{$num_rilis} = $key;
76 # print "$num_rilis. $key\n";
77 # $num++;
78 # }
79 0 print "1. $data_rilis->{'10'}->{'name'}\n";
80 0 print "2. $data_rilis->{'11'}->{'name'}\n";
81 0 print "Enter number choice : ";
82 0 chomp($num_data_rilis = <STDIN>);
83 0 ▶ if ($num_data_rilis ne '' and $num_data_rilis eq '1') {
Branch: 2 branches
BranchTrueFalseTotal
if ($num_data_rilis ne '' and $num_data_rilis eq '1') { } 0 0 0
elsif ($num_data_rilis eq 2) { } 0 0 0
Condition0%0/3
$num_data_rilis ne "" and $num_data_rilis eq 1
!ll&&!rl&&r
000
MC/DC0%0/2
$num_data_rilis ne "" and $num_data_rilis eq 1
$num_data_rilis ne "" $num_data_rilis eq 1
Truth table0%0/3
A and B
A= $num_data_rilis ne ""B= $num_data_rilis eq 1
ABresult
0X0
100
111
84 0 $boi_rilis = 'tambora';
85 0 $status = 1;
86 } elsif ($num_data_rilis eq 2) {
87 0 $boi_rilis = 'uluwatu';
88 0 $status = 1;
89 }
90 else {
91 0 $boi_rilis = 'tambora';
92 0 $status = 1;
93 }
94  
95 0 print "\n";
96 0 print "Rilis Activated : $boi_rilis\n\n";
97  
98 0 $data{'result'} = $status;
99 0 $data{'data'} = $boi_rilis;
100  
101 0 return \%data;
102 }
103 # Subroutine for form Name : :
104 # ------------------------------------------------------------------------
105 0 ▶sub form_name {
Subroutine form_name: not called CC=4 SCAR=30.0
Pod undocumented
106 0 my ($self, $name) = @_;
107 # Prepare Form :
108 0 my $name_form;
109 my $data_name;
110 0 my %data = ();
111  
112 # Form_name ;
113 0 print "\n";
114 0 ▶ if ($name ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name ne '') { } 0 0 0
115 0 print "Enter your name [$name] : ";
116 } else {
117 0 print "Enter your name : ";
118 }
119 0 chomp($name_form = <STDIN>);
120 0 ▶ if ($name_form ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name_form ne '') { } 0 0 0
121 0 $data_name = $name_form;
122 } else {
123 0 ▶ if ($name eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq '') { } 0 0 0
124 0 print "your name is empty !!! \n";
125 0 form_name();
126 } else {
127 0 $data_name = $name;
128 }
129 }
130  
131 0 return $data_name;
132 }
133 # Subroutine for Email Github :
134 # ------------------------------------------------------------------------
135 0 ▶sub form_email_git {
Subroutine form_email_git: not called CC=5 SCAR=34.0
Pod undocumented
136 0 my ($self, $email) = @_;
137 # Prepare Form :
138 0 my $emailGit_form;
139 my $data_emailGit;
140  
141 # Form Email Git :
142 0 print "\n";
143 0 ▶ if ($email ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($email ne '') { } 0 0 0
144 0 print "Enter your email address Github Account [$email] : ";
145 } else {
146 0 print "Enter your email address Github Account : ";
147 }
148 0 chomp($emailGit_form = <STDIN>);
149 0 ▶ if ($emailGit_form ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($emailGit_form ne '') { } 0 0 0
150 0 ▶ if ($emailGit_form =~ m/(.*)\@(.*).(.*)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($emailGit_form =~ /(.*)\@(.*).(.*)/) { } 0 0 0
151 0 $data_emailGit = $emailGit_form;
152 } else {
153 0 print "Please enter valid email address !!! \n";
154 0 form_email_git();
155 }
156 } else {
157 0 ▶ if ($email eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($email eq '') { } 0 0 0
158 0 print "your E-mail Github Account is empty !!! \n";
159 0 form_email_git();
160 } else {
161 0 $data_emailGit = $email;
162 }
163 }
164 0 return $data_emailGit;
165 }
166 # Subroutine for Email GnuPG :
167 # ------------------------------------------------------------------------
168 0 ▶sub form_email_gpg {
Subroutine form_email_gpg: not called CC=5 SCAR=34.0
Pod undocumented
169 0 my ($self, $email) = @_;
170 # Prepare Form :
171 0 my $emailGnuPG_form;
172 my $data_emailGnuPG;
173  
174 # Form Email GnuPG :
175 0 print "\n";
176 0 ▶ if ($email ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($email ne '') { } 0 0 0
177 0 print "Enter your email address for GnuPG Generate Key [$email] : ";
178 } else {
179 0 print "Enter your email address for GnuPG Generate Key : ";
180 }
181 0 chomp($emailGnuPG_form = <STDIN>);
182 0 ▶ if ($emailGnuPG_form ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($emailGnuPG_form ne '') { } 0 0 0
183 0 ▶ if ($emailGnuPG_form =~ m/(.*)\@(.*).(.*)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($emailGnuPG_form =~ /(.*)\@(.*).(.*)/) { } 0 0 0
184 0 $data_emailGnuPG = $emailGnuPG_form;
185 } else {
186 0 print "Please enter valid email address !!! \n";
187 0 form_email_gpg();
188 }
189 } else {
190 0 ▶ if ($email eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($email eq '') { } 0 0 0
191 0 print "your enter email is empty !!! \n";
192 0 form_email_gpg();
193 } else {
194 0 $data_emailGnuPG = $email;
195 }
196 }
197 0 return $data_emailGnuPG;
198 }
199 # Subroutine for Passphrase GnuPG :
200 # ------------------------------------------------------------------------
201 0 ▶sub form_passphrase_gpg {
Subroutine form_passphrase_gpg: not called CC=4 SCAR=30.0
Pod undocumented
202 0 my ($self) = @_;
203 # Prepare Form :
204 0 my $passph_form = '';
205 0 my $confirm_again;
206 my $data_passph;
207  
208 # From Passhphrase :
209 0 print "\n";
210 0 print "Enter Passphrase gpg : ";
211 0 ReadMode('noecho');
212 0 $passph_form = ReadLine(0);
213 0 ReadMode 1;
214 0 ▶ if ($passph_form ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($passph_form ne '') { } 0 0 0
215 0 $data_passph = $passph_form;
216 } else {
217 0 print "your enter passphrase gpg is empty !!! \n";
218 0 print "You want to try again ? [y or n] : ";
219 0 chomp($confirm_again = <STDIN>);
220 0 ▶ if ($confirm_again eq 'y' or $confirm_again eq 'Y') {
Branch: 1 branch
BranchTrueFalseTotal
if ($confirm_again eq "y" or $confirm_again eq "Y") 0 0 0
Condition0%0/3
$confirm_again eq "y" or $confirm_again eq "Y"
l!l&&r!l&&!r
000
MC/DC0%0/2
$confirm_again eq "y" or $confirm_again eq "Y"
$confirm_again eq "y" $confirm_again eq "Y"
Truth table0%0/3
A or B
A= $confirm_again eq "y"B= $confirm_again eq "Y"
ABresult
1X1
011
000
221 0 print "Enter Passphrase gpg : ";
222 0 ReadMode('noecho');
223 0 $passph_form = ReadLine(0);
224 0 ReadMode 1;
225 }
226 }
227 0 return $passph_form;
228 }
229 1 1;
« BlankOnDev/Form/github.pm ↑ Summary BlankOnDev/syslog.pm »