my $WARNINGS_CATEGORY;
BEGIN {
$WARNINGS_CATEGORY = 'File::KDBX';
- warnings::register_categories($WARNINGS_CATEGORY) if warnings->can('register_categories');
+ if (warnings->can('register_categories')) {
+ warnings::register_categories($WARNINGS_CATEGORY);
+ }
+ else {
+ eval qq{package $WARNINGS_CATEGORY; use warnings::register; 1}; ## no critic ProhibitStringyEval
+ }
}
use overload '""' => 'to_string', cmp => '_cmp';
my $indented_method = (' ' x $debug{level}) . $method;
my $self = shift;
print STDERR sprintf('%-20s -> %s (%s)', $indented_method, $self,
- join(', ', map { defined ? substr($_, 0, 16) : 'undef' } @_)), "\n";
+ join(', ', map { defined $_ ? substr($_, 0, 16) : 'undef' } @_)), "\n";
my $r = $orig->($self, @_) // 'undef';
print STDERR sprintf('%-20s <- %s [%s]', $indented_method, $self, $r), "\n";
return $r;