X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-File-KDBX;a=blobdiff_plain;f=lib%2FFile%2FKDBX%2FIO%2FCrypt.pm;h=4218af21fb0aeba685e3ba3dbbed478e55285413;hp=22fe45e306064990cd0724be36e841265a4a7db8;hb=37b09e0f2832514b33de4499a83f22d5ffe7c0a3;hpb=8a37f035ef35682b764c34e7b3c61ce03318b1c7 diff --git a/lib/File/KDBX/IO/Crypt.pm b/lib/File/KDBX/IO/Crypt.pm index 22fe45e..4218af2 100644 --- a/lib/File/KDBX/IO/Crypt.pm +++ b/lib/File/KDBX/IO/Crypt.pm @@ -6,33 +6,15 @@ use strict; use Errno; use File::KDBX::Error; -use File::KDBX::Util qw(:empty); +use File::KDBX::Util qw(:class :empty); use namespace::clean; -use parent 'File::KDBX::IO'; +extends 'File::KDBX::IO'; our $VERSION = '999.999'; # VERSION our $BUFFER_SIZE = 16384; our $ERROR; -=method new - - $fh = File::KDBX::IO::Crypt->new(%attributes); - $fh = File::KDBX::IO::Crypt->new($fh, %attributes); - -Construct a new crypto IO handle. - -=cut - -sub new { - my $class = shift; - my %args = @_ % 2 == 1 ? (fh => shift, @_) : @_; - my $self = $class->SUPER::new; - $self->_fh($args{fh}) or throw 'IO handle required'; - $self->cipher($args{cipher}) or throw 'Cipher required'; - return $self; -} - =attr cipher A L instance to do the actual encryption or decryption. @@ -51,6 +33,24 @@ while (my ($attr, $default) = each %ATTRS) { }; } +=method new + + $fh = File::KDBX::IO::Crypt->new(%attributes); + $fh = File::KDBX::IO::Crypt->new($fh, %attributes); + +Construct a new crypto IO handle. + +=cut + +sub new { + my $class = shift; + my %args = @_ % 2 == 1 ? (fh => shift, @_) : @_; + my $self = $class->SUPER::new; + $self->_fh($args{fh}) or throw 'IO handle required'; + $self->cipher($args{cipher}) or throw 'Cipher required'; + return $self; +} + sub _FILL { my ($self, $fh) = @_;