summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Xconfig/test.pm17
-rw-r--r--perl-install/devices.pm27
2 files changed, 20 insertions, 24 deletions
diff --git a/perl-install/Xconfig/test.pm b/perl-install/Xconfig/test.pm
index 2d465ab82..aa12d2b5b 100644
--- a/perl-install/Xconfig/test.pm
+++ b/perl-install/Xconfig/test.pm
@@ -67,15 +67,15 @@ sub test {
my $b = before_leaving { unlink $f_err };
if (!xtest(":9")) {
- local *F; open F, $f_err;
+ open my $F, $f_err;
local $_;
- i: while (<F>) {
+ i: while (<$F>) {
if (Xconfig::card::using_xf4($card)) {
if (/^\(EE\)/ && !/Disabling/ || /^Fatal\b/) {
my @msg = !/error/ && $_;
local $_;
- while (<F>) {
+ while (<$F>) {
/reporting a problem/ and last;
push @msg, $_;
$in->ask_warn('', [ N("An error occurred:"), " ", @msg, N("\ntry to change some parameters") ]);
@@ -86,7 +86,7 @@ sub test {
if (/\b(error|not supported)\b/i) {
my @msg = !/error/ && $_;
local $_;
- while (<F>) {
+ while (<$F>) {
/not fatal/ and last i;
/^$/ and last;
push @msg, $_;
@@ -99,10 +99,9 @@ sub test {
}
$::noShadow = 1;
- local *F;
- open F, "|perl 2>/dev/null";
- print F "use lib qw(", join(' ', @INC), ");\n";
- print F q(
+ open my $F, "|perl 2>/dev/null";
+ print $F "use lib qw(", join(' ', @INC), ");\n";
+ print $F q(
BEGIN { $::no_ugtk_init = 1 }
require lang;
require my_gtk;
@@ -138,7 +137,7 @@ sub test {
my $in = interactive::gtk->new;
$in->exit($in->ask_yesorno('', [ N("Is this the correct setting?"), $text ], 0) ? 0 : 222);
);
- my $rc = close F;
+ my $rc = close $F;
my $err = $?;
$rc || $err == 222 << 8 or $in->ask_warn('', N("An error occurred, try to change some parameters"));
diff --git a/perl-install/devices.pm b/perl-install/devices.pm
index bc84710f8..153017cdc 100644
--- a/perl-install/devices.pm
+++ b/perl-install/devices.pm
@@ -8,14 +8,14 @@ use run_program;
use log;
use c;
-sub size($) {
- local *F;
- sysopen F, $_[0], 0 or log::l("open $_[0]: $!"), return 0;
+sub size {
+ my ($dev) = @_;
+ sysopen(my $F, $dev, 0) or log::l("open $dev: $!"), return 0;
- my $valid_offset = sub { sysseek(F, $_[0], 0) && sysread(F, my $a, 1) };
+ my $valid_offset = sub { sysseek($F, $_[0], 0) && sysread($F, my $a, 1) };
#- first try getting the size nicely
- if (my $size = c::total_sectors(fileno F)) {
+ if (my $size = c::total_sectors(fileno $F)) {
return $size * $common::SECTORSIZE;
}
@@ -24,11 +24,11 @@ sub size($) {
my ($high, $mid);
#- first find n where 2^n < size <= 2^n+1
- for ($high = 1; $high > 0 && &$valid_offset($high); $high *= 2) { $low = $high }
+ for ($high = 1; $high > 0 && $valid_offset->($high); $high *= 2) { $low = $high }
while ($low < $high - 1) {
$mid = int(($low + $high) / 2);
- &$valid_offset($mid) ? $low : $high = $mid;
+ $valid_offset->($mid) ? $low : $high = $mid;
}
$low + 1;
}
@@ -40,10 +40,8 @@ sub del_loop {
sub find_free_loop {
foreach (0..7) {
my $dev = make("loop$_");
- local *F;
- sysopen F, $dev, 2 or next;
- !ioctl(F, c::LOOP_GET_STATUS(), my $tmp) && $! == 6 or next; #- 6 == ENXIO
- close F;
+ sysopen(my $F, $dev, 2) or next;
+ !ioctl($F, c::LOOP_GET_STATUS(), my $tmp) && $! == 6 or next; #- 6 == ENXIO
return $dev;
}
die "no free loop found";
@@ -55,10 +53,9 @@ sub set_loop {
if ($encrypt_key && $encryption) {
my $cmd = "losetup -p 0 -e $encryption $dev $file";
log::l("calling $cmd");
- local *F;
- open F, "|$cmd";
- print F $encrypt_key;
- close F or die "losetup failed";
+ open my $F, "|$cmd";
+ print $F $encrypt_key;
+ close $F or die "losetup failed";
} else {
run_program::run("losetup", $dev, $file) or return;
}