From: Charles McGarvey Date: Tue, 19 Apr 2022 00:29:38 +0000 (-0600) Subject: Fix error wrapping X-Git-Tag: v0.800~30 X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=cfadf8415f8ffe74c0d1f8d890dc1c155cfecd4f;p=chaz%2Fp5-File-KDBX Fix error wrapping --- diff --git a/lib/File/KDBX/Error.pm b/lib/File/KDBX/Error.pm index f801557..6ea0649 100644 --- a/lib/File/KDBX/Error.pm +++ b/lib/File/KDBX/Error.pm @@ -78,10 +78,11 @@ as a B. Example: =cut sub error { + my $class = @_ && $_[0] eq __PACKAGE__ ? shift : undef; my $self = (blessed($_[0]) && $_[0]->isa('File::KDBX::Error')) ? shift - : (@_ && $_[0] eq __PACKAGE__) - ? shift->new(@_) + : $class + ? $class->new(@_) : __PACKAGE__->new(@_); return $self; }