Do
view release on metacpan or search on metacpan
lib/Data/Object/Role/Tryable.pm view on Meta::CPAN
This package implements the following methods.
=cut
=head2 try
try(Str | CodeRef $method) : Object
The try method takes a method name or coderef and returns a
L<Data::Object::Try> object with the current object passed as the invocant
which means that C<try> and C<finally> callbacks will receive that as the first
argument.
=over 4
=item try example
my $try;
$try = $self->try($method);
$try = $self->try(fun ($self) {
lib/Data/Object/Try.pm view on Meta::CPAN
=head2 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 C<try> and C<finally>
callbacks will received an C<invocant> if one was provided to the constructor,
the default C<arguments> if any were provided to the constructor, and whatever
arguments were passed directly to this method.
=over 4
=item result example
my $result = $try->result(@args);
=back
t/0.90/can/Data_Object_Role_Tryable_try.t view on Meta::CPAN
$try = $self->try(fun ($self) {
# do something
return $something;
});
=description
The try method takes a method name or coderef and returns a
L<Data::Object::Try> object with the current object passed as the invocant
which means that C<try> and C<finally> callbacks will receive that as the first
argument.
=signature
try(Str | CodeRef $method) : Object
=type
method
t/0.90/can/Data_Object_Try_result.t view on Meta::CPAN
my $result = $try->result(@args);
=description
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 C<try> and C<finally>
callbacks will received an C<invocant> if one was provided to the constructor,
the default C<arguments> if any were provided to the constructor, and whatever
arguments were passed directly to this method.
=signature
result(Any @args) : Any
=type
method
( run in 0.575 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )