mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-27 16:59:36 +03:00
Use local variables instead of global filehandles
svn path=/trunk/netsurf/; revision=13068
This commit is contained in:
parent
6959a30b26
commit
da930e48ad
@ -30,9 +30,9 @@ sub gather_output {
|
|||||||
my $tmpfile = File::Temp::tmpnam();
|
my $tmpfile = File::Temp::tmpnam();
|
||||||
local $/ = undef();
|
local $/ = undef();
|
||||||
system("$cmd > $tmpfile");
|
system("$cmd > $tmpfile");
|
||||||
open CMDH, "<", $tmpfile;
|
open(my $CMDH, "<", $tmpfile);
|
||||||
my $ret = <CMDH>;
|
my $ret = <$CMDH>;
|
||||||
close CMDH;
|
close($CMDH);
|
||||||
unlink($tmpfile);
|
unlink($tmpfile);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
@ -137,22 +137,22 @@ use Digest::MD5 qw(md5_hex);
|
|||||||
|
|
||||||
my $oldcsum = "";
|
my $oldcsum = "";
|
||||||
if ( -e $targetfile ) {
|
if ( -e $targetfile ) {
|
||||||
open OLDVALUES, "<", $targetfile;
|
open(my $OLDVALUES, "<", $targetfile);
|
||||||
foreach my $line (readline(OLDVALUES)) {
|
foreach my $line (readline($OLDVALUES)) {
|
||||||
if ($line =~ /MD5:([0-9a-f]+)/) {
|
if ($line =~ /MD5:([0-9a-f]+)/) {
|
||||||
$oldcsum = $1;
|
$oldcsum = $1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close OLDVALUES;
|
close($OLDVALUES);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $newcsum = md5_hex($testament);
|
my $newcsum = md5_hex($testament);
|
||||||
|
|
||||||
if ($oldcsum ne $newcsum) {
|
if ($oldcsum ne $newcsum) {
|
||||||
print "TESTMENT: $targetfile\n";
|
print "TESTMENT: $targetfile\n";
|
||||||
open NEWVALUES, ">", $targetfile or die "$!";
|
open(my $NEWVALUES, ">", $targetfile) or die "$!";
|
||||||
print NEWVALUES "/* ", $targetfile,"\n";
|
print $NEWVALUES "/* ", $targetfile,"\n";
|
||||||
print NEWVALUES <<'EOS';
|
print $NEWVALUES <<'EOS';
|
||||||
*
|
*
|
||||||
* Revision testament.
|
* Revision testament.
|
||||||
*
|
*
|
||||||
@ -163,14 +163,14 @@ if ($oldcsum ne $newcsum) {
|
|||||||
|
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
print NEWVALUES "#ifndef NETSURF_REVISION_TESTAMENT\n";
|
print $NEWVALUES "#ifndef NETSURF_REVISION_TESTAMENT\n";
|
||||||
print NEWVALUES "#define NETSURF_REVISION_TESTAMENT \"$newcsum\"\n\n";
|
print $NEWVALUES "#define NETSURF_REVISION_TESTAMENT \"$newcsum\"\n\n";
|
||||||
print NEWVALUES "/* Revision testament checksum:\n";
|
print $NEWVALUES "/* Revision testament checksum:\n";
|
||||||
print NEWVALUES " * MD5:", $newcsum,"\n */\n\n";
|
print $NEWVALUES " * MD5:", $newcsum,"\n */\n\n";
|
||||||
print NEWVALUES "/* Revision testament: */\n";
|
print $NEWVALUES "/* Revision testament: */\n";
|
||||||
print NEWVALUES $testament;
|
print $NEWVALUES $testament;
|
||||||
print NEWVALUES "\n#endif\n";
|
print $NEWVALUES "\n#endif\n";
|
||||||
close NEWVALUES;
|
close($NEWVALUES);
|
||||||
foreach my $unwanted (@ARGV) {
|
foreach my $unwanted (@ARGV) {
|
||||||
next unless(-e $unwanted);
|
next unless(-e $unwanted);
|
||||||
print "TESTAMENT: Removing $unwanted\n";
|
print "TESTAMENT: Removing $unwanted\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user