Unexpected::Functions - A collection of functions used in this distribution
use Unexpected::Functions qw( build_attr_from );
A collection of functions used in this distribution
Also exports any exceptions defined by the caller's EXCEPTION_CLASS as subroutines that return the subroutines name as a string. The calling package can then throw exceptions with a class attribute that takes these subroutines return values
EXCEPTION_CLASS
Defines no attributes
$hash_ref = build_attr_from( <whatever> );
Coerces a hash ref from whatever args are passed
use Try::Tiny; try { die $exception_object } catch_class [ 'exception_class' => sub { # handle exception }, ... ], finally { # always do this };
See Try::Tiny::ByClass. Checks the exception object's class attribute against the list of exception class names passed to catch_class. If there is a match, call the subroutine provided to handle that exception. Re-throws the exception if there is no match of if the exception object has no class attribute
class
catch_class
has_exception 'exception_name' => parents => [ 'parent_exception' ], error => 'Error message for the exception with placeholders';
Calls "add_exception" in Unexpected::TraitFor::ExceptionClasses via the calling class which is assumed to inherit from a class that consumes the Unexpected::TraitFor::ExceptionClasses role
$message = inflate_message( $template, $arg1, $arg2, ... );
Substitute the placeholders in the $template string (e.g. [_1]) with the corresponding argument
$template
$bool = is_class_loaded $classname;
Returns true is the classname as already loaded and compiled
$bool = Unexpected::Functions->quote_bind_values( $bool );
Accessor / mutator package method that toggles the state on quoting the placeholder substitution values in inflate_message. Defaults to true
inflate_message
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Larry Wall - For the Perl programming language
Peter Flanigan, <pjfl@cpan.org>
<pjfl@cpan.org>
Copyright (c) 2014 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install Unexpected, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Unexpected
CPAN shell
perl -MCPAN -e shell install Unexpected
For more information on module installation, please visit the detailed CPAN module installation guide.