BlankOnDev
view release on metacpan or search on metacpan
lib/BlankOnDev/Form.pm view on Meta::CPAN
my $name_form;
my $data_name;
my %data = ();
# Form_name ;
print "\n";
if ($name ne '') {
print "Enter your name [$name] : ";
} else {
print "Enter your name : ";
}
chomp($name_form = <STDIN>);
if ($name_form ne '') {
$data_name = $name_form;
} else {
if ($name eq '') {
print "your name is empty !!! \n";
form_name();
} else {
$data_name = $name;
}
}
return $data_name;
}
# Subroutine for Email Github :
# ------------------------------------------------------------------------
sub form_email_git {
my ($self, $email) = @_;
# Prepare Form :
my $emailGit_form;
my $data_emailGit;
# Form Email Git :
print "\n";
if ($email ne '') {
print "Enter your email address Github Account [$email] : ";
} else {
print "Enter your email address Github Account : ";
}
chomp($emailGit_form = <STDIN>);
if ($emailGit_form ne '') {
if ($emailGit_form =~ m/(.*)\@(.*).(.*)/) {
$data_emailGit = $emailGit_form;
} else {
print "Please enter valid email address !!! \n";
form_email_git();
}
} else {
if ($email eq '') {
print "your E-mail Github Account is empty !!! \n";
form_email_git();
} else {
$data_emailGit = $email;
}
}
return $data_emailGit;
}
# Subroutine for Email GnuPG :
# ------------------------------------------------------------------------
sub form_email_gpg {
my ($self, $email) = @_;
# Prepare Form :
my $emailGnuPG_form;
my $data_emailGnuPG;
# Form Email GnuPG :
print "\n";
if ($email ne '') {
print "Enter your email address for GnuPG Generate Key [$email] : ";
} else {
print "Enter your email address for GnuPG Generate Key : ";
}
chomp($emailGnuPG_form = <STDIN>);
if ($emailGnuPG_form ne '') {
if ($emailGnuPG_form =~ m/(.*)\@(.*).(.*)/) {
$data_emailGnuPG = $emailGnuPG_form;
} else {
print "Please enter valid email address !!! \n";
form_email_gpg();
}
} else {
if ($email eq '') {
print "your enter email is empty !!! \n";
form_email_gpg();
} else {
$data_emailGnuPG = $email;
}
}
return $data_emailGnuPG;
}
# Subroutine for Passphrase GnuPG :
# ------------------------------------------------------------------------
sub form_passphrase_gpg {
my ($self) = @_;
# Prepare Form :
my $passph_form = '';
my $confirm_again;
my $data_passph;
# From Passhphrase :
print "\n";
print "Enter Passphrase gpg : ";
ReadMode('noecho');
$passph_form = ReadLine(0);
ReadMode 1;
if ($passph_form ne '') {
$data_passph = $passph_form;
} else {
print "your enter passphrase gpg is empty !!! \n";
print "You want to try again ? [y or n] : ";
chomp($confirm_again = <STDIN>);
if ($confirm_again eq 'y' or $confirm_again eq 'Y') {
print "Enter Passphrase gpg : ";
ReadMode('noecho');
$passph_form = ReadLine(0);
ReadMode 1;
}
}
return $passph_form;
}
1;
( run in 0.528 second using v1.01-cache-2.11-cpan-df04353d9ac )