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