]> Dogcows Code - chaz/p5-File-KDBX/blobdiff - lib/File/KDBX/Dumper.pm
Remove min_version and clean up a lot of pod
[chaz/p5-File-KDBX] / lib / File / KDBX / Dumper.pm
index 8be64be930cbda8f003d445c45a06be96e535fd0..6f8d8bb120936ab361606df3bf8157ac171c4f49 100644 (file)
@@ -7,6 +7,7 @@ use strict;
 use Crypt::Digest qw(digest_data);
 use File::KDBX::Constants qw(:magic :header :version :random_stream);
 use File::KDBX::Error;
+use File::KDBX::Util qw(:class);
 use File::KDBX;
 use IO::Handle;
 use Module::Load;
@@ -92,7 +93,7 @@ sub _rebless {
 
     $dumper = $dumper->reset;
 
-Set a L<File::KDBX::Dumper> to a blank state, ready to dumper another KDBX file.
+Set a L<File::KDBX::Dumper> to a blank state, ready to dump another KDBX file.
 
 =cut
 
@@ -110,7 +111,7 @@ sub reset {
 
 Dump a KDBX file.
 
-The C<$key> is either a L<File::KDBX::Key> or a primitive that can be converted to a Key object.
+The C<$key> is either a L<File::KDBX::Key> or a primitive that can be cast to a Key object.
 
 =cut
 
@@ -201,7 +202,7 @@ sub dump_file {
     $dumper->dump_handle($fh, $key);
     $dumper->dump_handle(*IO, $key);
 
-Dump a KDBX file to an input stream / file handle.
+Dump a KDBX file to an output stream / file handle.
 
 =cut
 
@@ -254,10 +255,6 @@ The most common reason to explicitly specify the file format is to save a databa
 
     $kdbx->dump_file('database.xml', format => 'XML');
 
-=cut
-
-sub format { $_[0]->{format} }
-
 =attr inner_format
 
 Get the format of the data inside the KDBX envelope. This only applies to C<V3> and C<V4> formats. Possible
@@ -267,23 +264,6 @@ formats:
 * C<XML> - Write the database groups and entries as XML (default)
 * C<Raw> - Write L<File::KDBX/raw> instead of the actual database contents
 
-=cut
-
-sub inner_format { $_[0]->{inner_format} // 'XML' }
-
-=attr min_version
-
-    $min_version = File::KDBX::Dumper->min_version;
-
-Get the minimum KDBX file version supported, which is 3.0 or C<0x00030000> as
-it is encoded.
-
-To generate older KDBX files unsupported by this module, try L<File::KeePass>.
-
-=cut
-
-sub min_version { KDBX_VERSION_OLDEST }
-
 =attr allow_upgrade
 
     $bool = $dumper->allow_upgrade;
@@ -294,10 +274,6 @@ too low to support new features being used.
 
 The default is to allow upgrading.
 
-=cut
-
-sub allow_upgrade { $_[0]->{allow_upgrade} // 1 }
-
 =attr randomize_seeds
 
     $bool = $dumper->randomize_seeds;
@@ -308,7 +284,10 @@ they are.
 
 =cut
 
-sub randomize_seeds { $_[0]->{randomize_seeds} // 1 }
+has 'format',           is => 'ro';
+has 'inner_format',     is => 'ro', default => 'XML';
+has 'allow_upgrade',    is => 'ro', default => 1;
+has 'randomize_seeds',  is => 'ro', default => 1;
 
 sub _fh { $_[0]->{fh} or throw 'IO handle not set' }
 
@@ -366,7 +345,7 @@ sub _write_magic_numbers {
     my $kdbx = $self->kdbx;
 
     $kdbx->sig1 == KDBX_SIG1 or throw 'Invalid file signature', sig1 => $kdbx->sig1;
-    $kdbx->version < $self->min_version || KDBX_VERSION_LATEST < $kdbx->version
+    $kdbx->version < KDBX_VERSION_OLDEST || KDBX_VERSION_LATEST < $kdbx->version
         and throw 'Unsupported file version', version => $kdbx->version;
 
     my @magic = ($kdbx->sig1, $kdbx->sig2, $kdbx->version);
This page took 0.019413 seconds and 4 git commands to generate.