From f37a988533a55020ad7a397b0be4b5bad6151a4a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 18 May 2011 08:22:28 +0200 Subject: Do not use autodie. Not counting disk IO, this increases performance by ~25% --- lib/App/Hashl.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/App/Hashl.pm b/lib/App/Hashl.pm index 0e08794..c0b7e8c 100644 --- a/lib/App/Hashl.pm +++ b/lib/App/Hashl.pm @@ -2,7 +2,6 @@ package App::Hashl; use strict; use warnings; -use autodie; use 5.010; use Digest::SHA qw(sha1_hex); @@ -106,10 +105,14 @@ sub hash_file { my ($self, $file) = @_; my ($fh, $data); - open($fh, '<', $file); - binmode($fh); - read($fh, $data, $self->{config}->{read_size}); - close($fh); + open($fh, '<', $file) + or die("Can't open ${file} for reading: $!\n");; + binmode($fh) + or die("Can't set binmode on ${file}: $!\n"); + read($fh, $data, $self->{config}->{read_size}) + or die("Can't read ${file}: $!\n"); + close($fh) + or die("Can't close ${file}: $!\n"); return sha1_hex($data); } -- cgit v1.2.3