X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=make%2Fconsole.pm;h=621de0274293815f8c5bcbd728310ea3d41b4d2e;hb=7a1ca5baf2fcc6884042680c423ca614c41051c2;hp=045df8a704c61afd2b6e15c398df597c0447e4c7;hpb=88bfcabe027216022df7b6f410f0dd862a92128d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/make/console.pm b/make/console.pm index 045df8a70..621de0274 100644 --- a/make/console.pm +++ b/make/console.pm @@ -20,9 +20,10 @@ package make::console; BEGIN { - require 5.8.0; + require 5.10.0; } +use feature ':5.10'; use strict; use warnings FATAL => qw(all); @@ -55,7 +56,7 @@ sub __console_format($$) { sub print_format($;$) { my $message = shift; - my $stream = shift || *STDOUT; + my $stream = shift // *STDOUT; while ($message =~ /(<\|(\S+)\s(.+?)\|>)/) { my $formatted = __console_format $2, $3; $message =~ s/\Q$1\E/$formatted/; @@ -87,12 +88,8 @@ sub prompt_dir($$$;$) { $answer = rel2abs(prompt_string($interactive, $question, $default)); $create = prompt_bool($interactive && !-d $answer, "$answer does not exist. Create it?", 'y'); if ($create && $create_now) { - my $mkpath = eval { - mkpath($answer, 0, 0750); - return 1; - }; - unless (defined $mkpath) { - print_warning "unable to create $answer!\n"; + unless (create_directory $answer, 0750) { + print_warning "unable to create $answer: $!\n"; $create = 0; } } @@ -106,7 +103,7 @@ sub prompt_string($$$) { print_format "$question\n"; print_format "[<|GREEN $default|>] => "; chomp(my $answer = ); - print "\n"; + say ''; return $answer ? $answer : $default; }