|
NAMEVenus::Role::Catchable - Catchable Role ABSTRACTCatchable Role for Perl 5 SYNOPSIS package Example;
use Venus::Class;
use Venus 'error';
with 'Venus::Role::Tryable';
with 'Venus::Role::Catchable';
sub pass {
true;
}
sub fail {
error;
}
package main;
my $example = Example->new;
# my $error = $example->catch('fail');
DESCRIPTIONThis package modifies the consuming package and provides methods for trapping errors thrown from dispatched method calls. METHODSThis package provides the following methods: catchcatch(string $method, any @args) (any) The catch method traps any errors raised by executing the dispatched method call and returns the error string or error object. This method can return a list of values in list-context. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method. Since 0.01
maybemaybe(string $method, any @args) (any) The maybe method traps any errors raised by executing the dispatched method call and returns undefined on error, effectively supressing the error. This method can return a list of values in list-context. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method. Since 2.91
AUTHORSAwncorp, "awncorp@cpan.org" LICENSECopyright (C) 2022, Awncorp, "awncorp@cpan.org". This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.
|