diff options
Diffstat (limited to 'lib/App/Hashl.pm')
-rw-r--r-- | lib/App/Hashl.pm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/App/Hashl.pm b/lib/App/Hashl.pm index ec779a9..dc5fca5 100644 --- a/lib/App/Hashl.pm +++ b/lib/App/Hashl.pm @@ -19,6 +19,7 @@ sub new { $ref->{config} = \%conf; $ref->{config}->{read_size} //= ( 2**20 ) * 4; # 4 MiB + $ref->{version} = $VERSION; return bless( $ref, $obj ); } @@ -28,6 +29,10 @@ sub new_from_file { my $ref = retrieve($file); + if ( not defined $ref->{version} ) { + $ref->{version} = '1.00'; + } + return bless( $ref, $obj ); } @@ -52,7 +57,7 @@ sub hash_file { if ( ( stat($file) )[7] == 0 ) { return $digest->hexdigest; } - if ($self->{config}->{read_size} == 0) { + if ( $self->{config}->{read_size} == 0 ) { $digest->addfile($file); return $digest->hexdigest; } @@ -102,6 +107,12 @@ sub read_size { return $self->{config}->{read_size}; } +sub db_version { + my ($self) = @_; + + return $self->{version}; +} + sub file { my ( $self, $name ) = @_; |