summaryrefslogtreecommitdiff
path: root/dselect/methods
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2012-12-30 01:42:11 +0100
committerGuillem Jover <guillem@debian.org>2013-04-24 01:16:59 +0200
commita62fb6adecfcb362e5f8927db33f32676668984a (patch)
tree99867eaca098cd08cc6ede32c1e7afd4e9063c93 /dselect/methods
parentca1f9b624cc91ea8ff2ab0e7e9b6d9869b05c1c9 (diff)
downloaddpkg-a62fb6adecfcb362e5f8927db33f32676668984a.tar.gz
Use three-argument form of open in perl code
Fixes InputOutput::ProhibitTwoArgOpen. Warned-by: perlcritic
Diffstat (limited to 'dselect/methods')
-rw-r--r--dselect/methods/Dselect/Ftp.pm6
-rwxr-xr-xdselect/methods/ftp/install12
2 files changed, 10 insertions, 8 deletions
diff --git a/dselect/methods/Dselect/Ftp.pm b/dselect/methods/Dselect/Ftp.pm
index fc21d1522..568e5f6f8 100644
--- a/dselect/methods/Dselect/Ftp.pm
+++ b/dselect/methods/Dselect/Ftp.pm
@@ -41,7 +41,9 @@ sub read_config {
my ($code, $conf);
local($/);
- open(VARS, $vars) || die "Couldn't open $vars : $!\nTry to relaunch the 'Access' step in dselect, thanks.\n";
+ open(VARS, '<', $vars) ||
+ die "Couldn't open $vars : $!\n" .
+ "Try to relaunch the 'Access' step in dselect, thanks.\n";
$code = <VARS>;
close VARS;
@@ -66,7 +68,7 @@ sub store_config {
# Check that config is completed
return if not $config{'done'};
- open(VARS, ">$vars") || die "Couldn't open $vars in write mode : $!\n";
+ open(VARS, '>', $vars) || die "Couldn't open $vars in write mode : $!\n";
print VARS Dumper(\%config);
close VARS;
}
diff --git a/dselect/methods/ftp/install b/dselect/methods/ftp/install
index 08bb84426..fdb1fc547 100755
--- a/dselect/methods/ftp/install
+++ b/dselect/methods/ftp/install
@@ -61,7 +61,7 @@ mkpath(["$methdir/$config{'dldir'}"], 0, 0755);
my %md5sums;
if (-f "$methdir/md5sums") {
local $/;
- open(MD5SUMS, "$methdir/md5sums") ||
+ open(MD5SUMS, '<', "$methdir/md5sums") ||
die "Couldn't read file $methdir/md5sums";
my $code = <MD5SUMS>;
close MD5SUMS;
@@ -114,7 +114,7 @@ print "Processing status file...\n";
my %curpkgs;
sub procstatus {
my (%flds, $fld);
- open (STATUS, "$vardir/status") or die "Could not open status file";
+ open (STATUS, '<', "$vardir/status") or die "Could not open status file";
while (%flds = getblk(\*STATUS), %flds) {
if($flds{'status'} =~ /^install ok/) {
my $cs = (split(/ /, $flds{'status'}))[2];
@@ -156,7 +156,7 @@ 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";
+ open(PKGFILE, '<', $fn) or die "Could not open package file $fn";
while(%flds = getblk(\*PKGFILE), %flds) {
$pkg = $flds{'package'};
$ver = $curpkgs{$pkg};
@@ -466,7 +466,7 @@ sub getdebinfo($) {
my $type = chkdeb($fn);
my ($pkg, $ver);
if($type == 1) {
- open(PKGFILE, "dpkg-deb --field $fn |");
+ open(PKGFILE, '-|', "dpkg-deb --field $fn");
my %fields = getblk(\*PKGFILE);
close(PKGFILE);
$pkg = $fields{'package'};
@@ -474,7 +474,7 @@ sub getdebinfo($) {
if($fields{'package_revision'}) { $ver .= '-' . $fields{'package_revision'}; }
return $pkg, $ver;
} elsif ( $type == 2) {
- open(PKGFILE, "dpkg-split --info $fn|");
+ open(PKGFILE, '-|', "dpkg-split --info $fn");
while(<PKGFILE>) {
/Part of package:\s*(\S+)/ and $pkg = $+;
/\.\.\. version:\s*(\S+)/ and $ver = $+;
@@ -623,7 +623,7 @@ foreach (keys %md5sums) {
next if (-f $_);
delete $md5sums{$_};
}
-open(MD5SUMS, ">$methdir/md5sums") ||
+open(MD5SUMS, '>', "$methdir/md5sums") ||
die "Can't open $methdir/md5sums in write mode : $!\n";
print MD5SUMS Dumper(\%md5sums);
close MD5SUMS;