… call non-existent methods on sometimes non-existent objects.
use Try::Chain qw(try_chain);
%hash = (
foo => scalar try_chain {
$obj
->foo(1)
->bar(2)
->baz(3, 4);
},
)
use Try::Chain qw($call_m);
%hash = (
bar => scalar $obj
->$call_m(foo => 1)
->$call_m(bar => 2)
->$call_m(baz => 3, 4),
)
use Try::Chain qw(try_chain);
@more = try_chain {
no autovivification;
$any
->foo
->[0]
->bar
->{2}
->baz;
};
use Try::Chain qw($call_m $fetch_ei $fetch_ek); @more = $any ->$call_m('foo') ->$fetch_ei(0) ->$call_m('bar') ->fetch_ek(2) ->$call_m('baz');
use Try::Chain qw($call_m); my $email = $location ->address ->email({ is_default => 1, is_active => 1, }) ->$call_m('first') ->$call_m(get_column => 'address');
use Try::Chain qw($call_em); my $customer_id = $order_message ->address ->$call_em('customer_id');
use Try::Chain qw($fetch_ek); $delivery_ref ->{head} ->$fetch_ek('document') ->$fetch_ek('pdf');
use Try::Chain;
Exports nothing by default, full import list is
use Try::Chain qw( try catch finally try_chain $call_m $call_em $fetch_i $fetch_ei $fetch_k $fetch_ek );