NAME
Error::Pure::Utils - Utilities for structured errors.
SYNOPSIS
use Error::Pure::Utils qw(clean err_get err_helper);
clean();
my @errors = err_get(1);
my @errors = err_helper('This is a fatal error', 'name', 'value');
SUBROUTINES
- clean()
-
Resets internal variables with errors. Is exportable.
- err_get([$clean])
-
Get and clean processed errors. err_get() returns error structure. err_get(1) returns error structure and delete it internally. Returns array of errors. Is exportable.
- err_helper(@msg)
-
Subroutine for additional module above Error::Pure. @msg is array of messages. Returns array of errors. Is exportable.
VARIABLES
- $LEVEL
-
Default value is 2.
- $MAX_LEVELS
-
Default value is 50.
- $MAX_EVAL
-
Default value is 100.
- $MAX_ARGS
-
Default value is 10.
- $MAX_ARG_LEN
-
Default value is 50.
- $PROGRAM
-
Program name in stack information. Default value is ''.
EXAMPLE
# Pragmas.
use strict;
use warnings;
# Modules.
use Dumpvalue;
use Error::Pure::Die qw(err);
use Error::Pure::Utils qw(err_get);
# Error in eval.
eval { err '1', '2', '3'; };
# Error structure.
my $err_ar = err_get();
# Dump.
my $dump = Dumpvalue->new;
$dump->dumpValues($err_ar);
# In $err_ar:
# [
# {
# 'msg' => [
# '1',
# '2',
# '3',
# ],
# 'stack' => [
# {
# 'args' => '(1)',
# 'class' => 'main',
# 'line' => '9',
# 'prog' => 'script.pl',
# 'sub' => 'err',
# },
# {
# 'args' => '',
# 'class' => 'main',
# 'line' => '9',
# 'prog' => 'script.pl',
# 'sub' => 'eval {...}',
# },
# ],
# },
# ],
DEPENDENCIES
Cwd(3pm), Exporter(3pm), Readonly(3pm).
SEE ALSO
Error::Pure(3pm), Error::Pure::AllError(3pm), Error::Pure::Error(3pm), Error::Pure::ErrorList(3pm), Error::Pure::Output::Text(3pm), Error::Pure::Print(3pm).
REPOSITORY
https://github.com/tupinek/Error-Pure
AUTHOR
Michal Špaček L<skim@cpan.org>
http://skim.cz
LICENSE AND COPYRIGHT
BSD license.
VERSION
0.02