Method-Cascade
view release on metacpan or search on metacpan
use strict;
use Test::More tests => 3;
use Method::Cascade;
{
package TestPkg;
sub new { bless { count => 0 }, shift};
sub inc { shift()->{count}++ }
sub get { shift()->{count} }
}
is(ref(cascade(TestPkg->new())), 'Method::Cascade::Wrapper');
is(ref(cascade(TestPkg->new())->inc->inc), 'Method::Cascade::Wrapper');
my $tp = TestPkg->new;
cascade($tp)->inc
->inc
->inc
->inc;
is($tp->get(), 4);
( run in 1.451 second using v1.01-cache-2.11-cpan-df04353d9ac )