-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEssent_v2.pm
80 lines (70 loc) · 1.18 KB
/
Essent_v2.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use warnings;
use strict;
{
package Data;
sub remove_outerspace {
my $string = shift;
if (defined $string) {
$string =~ s/^\s+//;
$string =~ s/\s+$//;
}
return $string;
}
}
{
package Env;
use File::HomeDir;
sub find_home {
my $home = File::HomeDir->my_home;
if ( -d $home ) {
return $home
} else {
warn "home-dir does not exist!?\n";
}
}
}
{
package Process;
sub confirm {
my $eingabe='';
until ( $eingabe eq 'y' ) {
print "Continue with 'y'..\n>";
$eingabe = <STDIN>;
chomp $eingabe;
}
}
sub confirmJN {
my $eingabe='';
my @exp_keys = ('j','n');
until (grep {$eingabe eq $_} @exp_keys) {
print "(j)a oder (n)ein... \n>";
$eingabe = <STDIN>;
chomp $eingabe;
}
if ($eingabe eq 'j') {
return 1;
} else {
return 0;
}
}
sub enter_str {
my $eingabe;
print "\n>";
$eingabe = <STDIN>;
chomp $eingabe;
return $eingabe;
}
sub confirm_numcount {
my $max = shift;
my $eingabe='';
my @exp_keys = (1..$max);
until (grep {$eingabe eq $_} @exp_keys) {
print (join ",", @exp_keys);
print "\n>";
$eingabe = <STDIN>;
chomp $eingabe;
}
return $eingabe+0;
}
}
1;