The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Mock::Object::Chain - Create mocked method chains.

VERSION

version 0.2

SYNOPSIS

   my $chain = create_method_chain([@list_of_methods, $final_value]);

DESCRIPTION

For internal use only.

SUBROUTINES

create_method_chain([@list_of_methods, $final_response]

   my $chain = create_method_chain([qw/foo bar baz/, 42]);
   say $chain->foo->bar->baz; # 42

If any method can be an array reference containing a Test::Mock::Object::Chain object and a method name. That will add the method name to the chain. Using the above chain:

   $chain = create_method_chain([[$chain, 'bar'], 'this', 23]);
   say $chain->bar->this; # 23

AUTHOR

Curtis "Ovid" Poe <ovid@allaroundtheworld.fr>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2021 by Curtis "Ovid" Poe.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)