Subject: | [WISHLIST] $_call_chain method |
Date: | Wed, 5 Dec 2018 15:53:15 +0000 |
To: | bug-Safe-Isa [...] rt.cpan.org |
From: | Robert Rothenberg <rrwo [...] cpan.org> |
It would be nice to have a $_call_cahain method that chains methods without
arguments, e.g.
$obj->foo->bar->baz
could be written as
$obj->$_call_chain( qw[ foo bar baz ] );
and implemented something like
our $_call_chain = sub {
my $this = shift;
while (my $method = shift) {
$this = $this->$_call_if_can($method)
// return;
}
return $this;
};
Note above has v5.10 syntax.