[Git][reproducible-builds/strip-nondeterminism][master] 2 commits: Move exception handling closer to call

Chris Lamb gitlab at salsa.debian.org
Tue May 4 13:40:22 UTC 2021



Chris Lamb pushed to branch master at Reproducible Builds / strip-nondeterminism


Commits:
ed397cb2 by Bernhard M. Wiedemann at 2021-05-04T14:44:13+02:00
Move exception handling closer to call

using perl's // operator (explained in `man perlop`)

requires perl 5.10 from 2007

- - - - -
26b47c85 by Chris Lamb at 2021-05-04T13:40:16+00:00
Merge branch 'perlread' into 'master'

Move exception handling closer to call

See merge request reproducible-builds/strip-nondeterminism!12
- - - - -


1 changed file:

- lib/File/StripNondeterminism/handlers/pyzip.pm


Changes:

=====================================
lib/File/StripNondeterminism/handlers/pyzip.pm
=====================================
@@ -63,7 +63,6 @@ sub normalize {
 	my ($filename) = @_;
 
 	my $buf;
-	my $bytes_read;
 
 	# Create a .zip file without the shebang
 	my $stripped = File::Temp->new(DIR => dirname($filename));
@@ -73,10 +72,9 @@ sub normalize {
 	my $shebang = <$fh>; 
 
 	# Copy through the rest of the file
-	while ($bytes_read = read($fh, $buf, 4096)) {
+	while (read($fh, $buf, 4096) // die "$filename: read failed: $!") {
 		print $stripped $buf;
 	}
-	defined($bytes_read) or die "$filename: read failed: $!";
 	$stripped->close;
 	close $fh;
 
@@ -92,7 +90,7 @@ sub normalize {
 	my $pyzip = File::Temp->new(DIR => dirname($filename));
 	print $pyzip $shebang;
 	open $fh, '<', $stripped->filename;
-	while ($bytes_read = read($fh, $buf, 4096)) {
+	while (read($fh, $buf, 4096)) {
 		print $pyzip $buf;
 	}
 	close $fh;



View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/-/compare/064e276d70b7d1462ac478c9b1adb88c2d59c42b...26b47c85ebfe764205238366d1d096b95621e0a6

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/-/compare/064e276d70b7d1462ac478c9b1adb88c2d59c42b...26b47c85ebfe764205238366d1d096b95621e0a6
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20210504/b577d3bf/attachment.htm>


More information about the rb-commits mailing list