]> Dogcows Code - chaz/p5-File-KDBX/blobdiff - lib/File/KDBX/Error.pm
Adjust dependencies
[chaz/p5-File-KDBX] / lib / File / KDBX / Error.pm
index 6ea064970b850d4f893abbe8cf540b55e1fb518c..7f44942caaee88e9a16acd9e72e6399bcb6422be 100644 (file)
@@ -15,7 +15,12 @@ our @EXPORT = qw(alert error throw);
 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';
@@ -65,7 +70,7 @@ passed will be forwarded to L</new> to create a new error object.
 This can be convenient for error handling when you're not sure what the exception is but you want to treat it
 as a B<File::KDBX::Error>. Example:
 
-    eval { .... };
+    eval { ... };
     if (my $error = error(@_)) {
         if ($error->type eq 'key.missing') {
             handle_missing_key($error);
This page took 0.021971 seconds and 4 git commands to generate.