X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FFile%2FKDBX%2FError.pm;h=4aee5fe995512a2c5a97cdbd8ac53ca78579da58;hb=afae2e268e27694e7d64721dd974d22ed3efae9b;hp=86442f3bdc306a071a2101cb462e6f3b9dbfbd2b;hpb=331a54019664704eb4a10186cb4abd7a2a722f30;p=chaz%2Fp5-File-KDBX diff --git a/lib/File/KDBX/Error.pm b/lib/File/KDBX/Error.pm index 86442f3..4aee5fe 100644 --- a/lib/File/KDBX/Error.pm +++ b/lib/File/KDBX/Error.pm @@ -1,6 +1,7 @@ package File::KDBX::Error; # ABSTRACT: Represents something bad that happened +use 5.010; use warnings; use strict; @@ -24,7 +25,7 @@ BEGIN { my $debug = $ENV{DEBUG}; $debug = looks_like_number($debug) ? (0 + $debug) : ($debug ? 1 : 0); - *DEBUG = $debug == 1 ? sub() { 1 } : + *_DEBUG = $debug == 1 ? sub() { 1 } : $debug == 2 ? sub() { 2 } : $debug == 3 ? sub() { 3 } : $debug == 4 ? sub() { 4 } : sub() { 0 }; @@ -147,8 +148,8 @@ sub type { $_[0]->details->{type} // '' } Stringify an error. -This does not contain a stack trace, but you can set the C environment -variable to truthy to stringify the whole error object. +This does not contain a stack trace, but you can set the C environment variable to at least 2 to +stringify the whole error object. =cut @@ -158,7 +159,7 @@ sub to_string { my $self = shift; my $msg = "$self->{trace}[0]"; $msg .= '.' if $msg !~ /[\.\!\?]$/; - if (2 <= DEBUG) { + if (2 <= _DEBUG) { require Data::Dumper; local $Data::Dumper::Indent = 1; local $Data::Dumper::Quotekeys = 0;