-
-
23 Feb 2022 22:56:59 UTC
- Distribution: Error-Pure
- Module version: 0.27
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (1779 / 1 / 0)
- Kwalitee
Bus factor: 1- 87.90% Coverage
- License: bsd
- Perl: v5.8.0
- Activity
24 month- Tools
- Download (38.46KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Cwd
- English
- Error::Pure::Output::Text
- Exporter
- List::MoreUtils
- Readonly
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- SYNOPSIS
- SUBROUTINES
- VARIABLES
- EXAMPLE1
- EXAMPLE2
- EXAMPLE3
- EXAMPLE4
- EXAMPLE5
- DEPENDENCIES
- SEE ALSO
- ACKNOWLEDGMENTS
- REPOSITORY
- AUTHOR
- LICENSE AND COPYRIGHT
- VERSION
NAME
Error::Pure - Perl module for structured errors.
SYNOPSIS
use Error::Pure qw(err); err 'This is a fatal error', 'name', 'value';
SUBROUTINES
err
err 'This is a fatal error', 'name', 'value';
Process error with message(s). There is key => value list after first message.
VARIABLES
$LEVEL
-
Error level for Error::Pure. Default value is 4.
$TYPE
-
Available are last names in Error::Pure::* modules. Error::Pure::ErrorList means 'ErrorList'. If does defined ENV variable 'ERROR_PURE_TYPE', system use it. Default value is 'Die'. Precedence: 1) $Error::Pure::TYPE 2) $ENV{'ERROR_PURE_TYPE'} 3) $Error::Pure::TYPE_DEFAULT = 'Die'
EXAMPLE1
use strict; use warnings; use Error::Pure qw(err); # Set env error type. $ENV{'ERROR_PURE_TYPE'} = 'Die'; # Error. err '1'; # Output: # 1 at example1.pl line 9.
EXAMPLE2
use strict; use warnings; use Error::Pure qw(err); # Set env error type. $ENV{'ERROR_PURE_TYPE'} = 'ErrorList'; # Error. err '1'; # Output something like: # #Error [path_to_script:12] 1
EXAMPLE3
use strict; use warnings; use Error::Pure qw(err); # Set error type. $Error::Pure::TYPE = 'AllError'; # Error. err '1'; # Output something like: # ERROR: 1 # main err path_to_script 12
EXAMPLE4
use strict; use warnings; use Error::Pure qw(err); $SIG{__DIE__} = sub { my $err = shift; $err =~ s/ at .*\n//ms; $Error::Pure::LEVEL = 5; $Error::Pure::TYPE = 'ErrorList'; err $err; }; # Error. die 'Error'; # Output. # #Error [path_to_script.pl:17] Error
EXAMPLE5
use strict; use warnings; use English qw(-no_match_vars); use Error::Pure qw(err); use Error::Pure::Utils qw(err_msg_hr); # Eval block. eval { err 'Error', 'Key1', 'Value1', 'Key2', 'Value2'; }; if ($EVAL_ERROR) { print $EVAL_ERROR; my $err_msg_hr = err_msg_hr(); foreach my $key (sort keys %{$err_msg_hr}) { print "$key: $err_msg_hr->{$key}\n"; } } # Output. # Error # Key1: Value1 # Key2: Value2
DEPENDENCIES
English, Error::Pure::Utils, Exporter, Readonly.
SEE ALSO
- Task::Error::Pure
-
Install the Error::Pure modules.
ACKNOWLEDGMENTS
Jakub Špičak and his Masser (http://masser.sf.net).
REPOSITORY
https://github.com/michal-josef-spacek/Error-Pure
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2008-2022 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.27
Module Install Instructions
To install Error::Pure, copy and paste the appropriate command in to your terminal.
cpanm Error::Pure
perl -MCPAN -e shell install Error::Pure
For more information on module installation, please visit the detailed CPAN module installation guide.