diff options
Diffstat (limited to 'dselect/methods/ftp/install')
-rwxr-xr-x | dselect/methods/ftp/install | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/dselect/methods/ftp/install b/dselect/methods/ftp/install index fdb1fc547..747742e54 100755 --- a/dselect/methods/ftp/install +++ b/dselect/methods/ftp/install @@ -61,10 +61,10 @@ mkpath(["$methdir/$config{'dldir'}"], 0, 0755); my %md5sums; if (-f "$methdir/md5sums") { local $/; - open(MD5SUMS, '<', "$methdir/md5sums") || + open(my $md5sums_fh, '<', "$methdir/md5sums") || die "Couldn't read file $methdir/md5sums"; - my $code = <MD5SUMS>; - close MD5SUMS; + my $code = <$md5sums_fh>; + close $md5sums_fh; my $VAR1; my $res = eval $code; if ($@) { @@ -114,8 +114,9 @@ print "Processing status file...\n"; my %curpkgs; sub procstatus { my (%flds, $fld); - open (STATUS, '<', "$vardir/status") or die "Could not open status file"; - while (%flds = getblk(\*STATUS), %flds) { + open(my $status_fh, '<', "$vardir/status") or + die "Could not open status file"; + while (%flds = getblk($status_fh), %flds) { if($flds{'status'} =~ /^install ok/) { my $cs = (split(/ /, $flds{'status'}))[2]; if(($cs eq "not-installed") || @@ -127,7 +128,7 @@ sub procstatus { } } } - close(STATUS); + close($status_fh); } procstatus(); @@ -156,8 +157,8 @@ sub procpkgfile { my $dist = shift; my(@files,@sizes,@md5sums,$pkg,$ver,$fl,$nfs,$fld); my(%flds); - open(PKGFILE, '<', $fn) or die "Could not open package file $fn"; - while(%flds = getblk(\*PKGFILE), %flds) { + open(my $pkgfile_fh, '<', $fn) or die "Could not open package file $fn"; + while (%flds = getblk($pkgfile_fh), %flds) { $pkg = $flds{'package'}; $ver = $curpkgs{$pkg}; @files = split(/[\s\n]+/, $flds{'filename'}); @@ -466,20 +467,20 @@ sub getdebinfo($) { my $type = chkdeb($fn); my ($pkg, $ver); if($type == 1) { - open(PKGFILE, '-|', "dpkg-deb --field $fn"); - my %fields = getblk(\*PKGFILE); - close(PKGFILE); + open(my $pkgfile_fh, '-|', "dpkg-deb --field $fn"); + my %fields = getblk($pkgfile_fh); + close($pkgfile_fh); $pkg = $fields{'package'}; $ver = $fields{'version'}; if($fields{'package_revision'}) { $ver .= '-' . $fields{'package_revision'}; } return $pkg, $ver; } elsif ( $type == 2) { - open(PKGFILE, '-|', "dpkg-split --info $fn"); - while(<PKGFILE>) { + open(my $pkgfile_fh, '-|', "dpkg-split --info $fn"); + while (<$pkgfile_fh>) { /Part of package:\s*(\S+)/ and $pkg = $+; /\.\.\. version:\s*(\S+)/ and $ver = $+; } - close(PKGFILE); + close($pkgfile_fh); return $pkg, $ver; } print "could not figure out type of $fn\n"; @@ -623,9 +624,9 @@ foreach (keys %md5sums) { next if (-f $_); delete $md5sums{$_}; } -open(MD5SUMS, '>', "$methdir/md5sums") || +open(my $md5sums_fh, '>', "$methdir/md5sums") || die "Can't open $methdir/md5sums in write mode : $!\n"; -print MD5SUMS Dumper(\%md5sums); -close MD5SUMS; +print $md5sums_fh Dumper(\%md5sums); +close $md5sums_fh; exit $exit; |