1package Bread::Board::Service::Deferred::Thunk; 2our $AUTHORITY = 'cpan:STEVAN'; 3# ABSTRACT: Helper for using services with incomplete parameters 4$Bread::Board::Service::Deferred::Thunk::VERSION = '0.37'; 5use Moose; 6 7has 'thunk' => ( 8 traits => [ 'Code' ], 9 is => 'bare', 10 isa => 'CodeRef', 11 required => 1, 12 handles => { 13 'inflate' => 'execute' 14 } 15); 16 171; 18 19__END__ 20 21=pod 22 23=encoding UTF-8 24 25=head1 NAME 26 27Bread::Board::Service::Deferred::Thunk - Helper for using services with incomplete parameters 28 29=head1 VERSION 30 31version 0.37 32 33=head1 DESCRIPTION 34 35This class is used when L<resolving dependencies that need 36parameters|Bread::Board::Service::WithDependencies/resolve_dependencies>. 37 38Since the service needs parameters to instantiate its value, and no 39values were provided for those parameters, the best we can do is use a 40coderef that will accept the parameters and call C<get> on the 41service. 42 43=head1 METHODS 44 45=head2 C<inflate> 46 47 my $service_value = $deferred_thunk->inflate(%service_parameters); 48 49This will call C<get> on the service, passing it all the 50C<%service_parameters>. Normal parameter validation and service 51lifecycle apply. 52 53=head1 AUTHOR 54 55Stevan Little <stevan@iinteractive.com> 56 57=head1 BUGS 58 59Please report any bugs or feature requests on the bugtracker website 60https://github.com/stevan/BreadBoard/issues 61 62When submitting a bug or request, please include a test-file or a 63patch to an existing test-file that illustrates the bug or desired 64feature. 65 66=head1 COPYRIGHT AND LICENSE 67 68This software is copyright (c) 2019, 2017, 2016, 2015, 2014, 2013, 2011, 2009 by Infinity Interactive. 69 70This is free software; you can redistribute it and/or modify it under 71the same terms as the Perl 5 programming language system itself. 72 73=cut 74