summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2012-07-14 09:51:19 +0200
committerDaniel Friesel <derf@finalrewind.org>2012-07-14 09:51:19 +0200
commit0e96a7165de21a1e14d106224ab41d58a1b65db1 (patch)
tree7f05ca561f16a3df65be1b7587ca528fc5e2f47a /lib
parent7cc60cd4f505634fd1d4cdb052ceb1769be4e3a0 (diff)
save database version, just to be safe
Diffstat (limited to 'lib')
-rw-r--r--lib/App/Hashl.pm13
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 ) = @_;