my $file = shift;
print "Reading ASCII database from $file..." if $verbose >= 1;
- open( F, "<$file" ) or
+ open( my $fh, '<', $file ) or
die "Can't open database $file: $!\n";
local($/) = ""; # read in paragraph mode
- while( <F> ) {
+ while( <$fh> ) {
my( %thispkg, $name );
s/[\s\n]+$//;
s/\n[ \t]+/\376\377/g; # fix continuation lines
or die $dbh->errstr;
}
}
- close( F );
+ close( $fh );
print "done\n" if $verbose >= 1;
}
my($name,$pkg,$key);
print "Writing ASCII database to $file..." if $verbose >= 1;
- open( F, ">$file" ) or
+ open( my $fh, '>', $file ) or
die "Can't open export $file: $!\n";
my $db = get_all_source_info();
$val =~ s/\n*$//;
$val =~ s/^/ /mg;
$val =~ s/^ +$/ ./mg;
- print F "$key: $val\n";
+ print $fh "$key: $val\n";
}
- print F "\n";
+ print $fh "\n";
}
- close( F );
+ close( $fh );
print "done\n" if $verbose >= 1;
}
$to .= '@' . $domain if $to !~ /\@/;
$text =~ s/^\.$/../mg;
local $SIG{'PIPE'} = 'IGNORE';
- open( PIPE, "| $conf::mailprog -oem $to" )
+ open( my $pipe, '|-', "$conf::mailprog -oem $to" )
or die "Can't open pipe to $conf::mailprog: $!\n";
chomp $text;
- print PIPE "From: $from\n";
- print PIPE "Subject: $subject\n\n";
- print PIPE "$text\n";
- close( PIPE );
+ print $pipe "From: $from\n";
+ print $pipe "Subject: $subject\n\n";
+ print $pipe "$text\n";
+ close( $pipe );
}
# for parsing input to dep-wait
my $packagearch="";
foreach my $packagefile (@$packagefiles) {
- open(P,$packagefile);
- while (<P>) {
+ open(my $fh,'<', $packagefile);
+ while (<$fh>) {
next unless /^Architecture/;
next if /^Architecture:\s*all/;
/Architecture:\s*([^\s]*)/;
return "Package file contains different architectures: $packagearch, $1";
}
}
- close P;
+ close $fh;
}
if ( $architecture eq "" ) {
}
print "calling: edos-debcheck $edosoptions < $sourcesfile ".join('', map {" '-base FILE' ".$_ } @$packagefiles)."\n";
- open(RESULT, '-|',
+ open(my $result_cmd, '-|',
"edos-debcheck $edosoptions < $sourcesfile ".join('', map {" '-base FILE' ".$_ } @$packagefiles));
my $explanation="";
my $result={};
my $binpkg="";
- while (<RESULT>) {
+ while (<$result_cmd>) {
# source---pulseaudio (= 0.9.15-4.1~bpo50+1): FAILED
# source---pulseaudio (= 0.9.15-4.1~bpo50+1) depends on missing:
# - libltdl-dev (>= 2.2.6a-2)
}
}
- close RESULT;
+ close $result_cmd;
$result->{$binpkg} = $explanation if $binpkg;
return $result;
}
my($lastmsg, %n_state, $total, %n_builder);
-open( PIPE, "wanna-build --database=$database --dist=$dist --list=all 2>&1 |" )
+open( my $pipe, '-|', "wanna-build --database=$database --dist=$dist --list=all 2>&1" )
or die "Cannot spawn wanna-build: $!\n";
-while( <PIPE> ) {
+while( <$pipe> ) {
if (/^Database for $dist doesn't exist$/) {
exit 1;
}
}
$lastmsg = $_;
}
-close( PIPE );
+close( $pipe );
if ($?) {
print "$lastmsg";
die "Bad exit status $? from wanna-build\n";
my($lastmsg, %n_state, $total, %n_builder, $pu_total);
$pu_total = 0;
$n_state{"Installed"} = 0;
-open( PIPE, "wanna-build --database=$arch/build-db --dist=$dist --list=all |" )
+open( my $pipe, '-|', "wanna-build --database=$arch/build-db --dist=$dist --list=all" )
or die "Cannot spawn wanna-build: $!\n";
-while( <PIPE> ) {
+while( <$pipe> ) {
if (/^Database for $dist doesn't exist$/) {
last;
}
}
$lastmsg = $_;
}
-close( PIPE );
+close( $pipe );
if ($?) {
print ", 0, 0";
} else {
my $pas = {};
local($/) = "\n";
- open(PAS, '<', $pasfile);
- while(<PAS>) {
+ open(my $pas, '<', $pasfile);
+ while(<$pas>) {
chomp;
s,\s*#.*,,;
next unless $_;
my ($p, $c) = split(/:\s*/);
$pas->{$p} = { arch => [ split(/\s+/, $c) ], mode => substr($c, 0, 1) ne '!' };
}
- close PAS;
+ close $pas;
my $srcs = {};
local($/) = ""; # read in paragraph mode