summaryrefslogtreecommitdiff
path: root/lib/App/Hashl.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/Hashl.pm')
-rw-r--r--lib/App/Hashl.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/App/Hashl.pm b/lib/App/Hashl.pm
index 1f43060..2c382ea 100644
--- a/lib/App/Hashl.pm
+++ b/lib/App/Hashl.pm
@@ -47,6 +47,11 @@ sub hash_file {
my ( $self, $file ) = @_;
my $data;
+ # read() fails for empty files
+ if ( ( stat($file) )[7] == 0 ) {
+ return sha1_hex();
+ }
+
#<<< perltidy has problems indenting 'or die' with tabs
open( my $fh, '<', $file )