Data-Object-Try
view release on metacpan or search on metacpan
$try->no_default;
no_finally
no_finally() : Object
The no_finally method removes any configured finally condition and
returns the object.
no_finally example #1
use routines;
my $try = Data::Object::Try->new(
invocant => Example->new,
arguments => [1,2,3]
);
$try->call(fun (@args) {
return $try;
});
$try->finally(fun (@args) {
$try->{'$finally'} = [@args];
});
$try->no_finally;
no_try
no_try() : Object
The no_try method removes any configured try operation and returns the
object.
no_try example #1
use routines;
my $try = Data::Object::Try->new;
$try->call(fun (@args) {
return [@args];
});
$try->no_try;
result
result(Any @args) : Any
The result method executes the try/catch/default/finally logic and
returns either 1) the return value from the successfully tried
operation 2) the return value from the successfully matched catch
condition if an exception was thrown 3) the return value from the
default catch condition if an exception was thrown and no catch
condition matched. When invoked, the try and finally callbacks will
received an invocant if one was provided to the constructor, the
default arguments if any were provided to the constructor, and whatever
arguments were passed directly to this method.
result example #1
use routines;
my $try = Data::Object::Try->new;
$try->call(fun (@args) {
return [@args];
});
$try->result;
result example #2
use routines;
my $try = Data::Object::Try->new;
$try->call(fun (@args) {
return [@args];
});
$try->result(1..5);
AUTHOR
Al Newkirk, awncorp@cpan.org
LICENSE
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under
the terms of the The Apache License, Version 2.0, as elucidated in the
"license file"
<https://github.com/iamalnewkirk/data-object-try/blob/master/LICENSE>.
PROJECT
Wiki <https://github.com/iamalnewkirk/data-object-try/wiki>
Project <https://github.com/iamalnewkirk/data-object-try>
Initiatives <https://github.com/iamalnewkirk/data-object-try/projects>
Milestones <https://github.com/iamalnewkirk/data-object-try/milestones>
Contributing
<https://github.com/iamalnewkirk/data-object-try/blob/master/CONTRIBUTE.md>
Issues <https://github.com/iamalnewkirk/data-object-try/issues>
( run in 2.363 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )