| 1 | package Bolts::Role::Locator; | ||
| 2 | 10 | $Bolts::Role::Locator::VERSION = '0.143170'; | |
| 3 | # ABSTRACT: Interface for locating artifacts in a bag | ||
| 4 | |||
| 5 | 10 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | |||
| 8 | 10 | requires 'acquire'; | |
| 9 | |||
| 10 | |||
| 11 | 10 | requires 'acquire_all'; | |
| 12 | |||
| 13 | |||
| 14 | 10 | requires 'resolve'; | |
| 15 | |||
| 16 | |||
| 17 | 10 | requires 'get'; | |
| 18 | |||
| 19 | 10 | 1; | |
| 20 | |||
| 21 | __END__ | ||
| 22 | |||
| 23 | =pod | ||
| 24 | |||
| 25 | =encoding UTF-8 | ||
| 26 | |||
| 27 | =head1 NAME | ||
| 28 | |||
| 29 | Bolts::Role::Locator - Interface for locating artifacts in a bag | ||
| 30 | |||
| 31 | =head1 VERSION | ||
| 32 | |||
| 33 | version 0.143170 | ||
| 34 | |||
| 35 | =head1 DESCRIPTION | ||
| 36 | |||
| 37 | This is the interface that any locator must implement. A locator's primary job is to provide a way to find artifacts within a bag or selection of bags. This performs the acquisition and resolution process. | ||
| 38 | |||
| 39 | The reference implementation of this interface is found in L<Bolts::Role::RootLocator>. | ||
| 40 | |||
| 41 | =head1 REQUIRED METHODS | ||
| 42 | |||
| 43 | =head2 acquire | ||
| 44 | |||
| 45 | my $artifact = $loc->acquire(\@path); | ||
| 46 | |||
| 47 | Given a C<@path> of symbol names to traverse, this goes through each artifact in turn, resolves it, if necessary, and then continues to the next path component. | ||
| 48 | |||
| 49 | When complete, the complete, resolved artifact found is returned. | ||
| 50 | |||
| 51 | =head2 acquire_all | ||
| 52 | |||
| 53 | my @artifacts = @{ $loc->acquire_all(\@path) }; | ||
| 54 | |||
| 55 | This is similar to L<acquire>, but if the last bag is a reference to an array, then all the artifacts within that bag are acquired, resolved, and returned as a reference to an array. | ||
| 56 | |||
| 57 | If the last item found at the path is not an array, it returns an empty list. | ||
| 58 | |||
| 59 | =head2 resolve | ||
| 60 | |||
| 61 | my $resolved_artifact = $loc->resolve($bag, $artifact, \%options); | ||
| 62 | |||
| 63 | After the artifact has been found, this method resolves the a partial artifact implementing the L<Bolts::Role::Artifact> and turns it into the complete artifact. | ||
| 64 | |||
| 65 | =head2 get | ||
| 66 | |||
| 67 | my $artifact = $log->get($component); | ||
| 68 | |||
| 69 | Given a single symbol name as the path component to find during acquisition it returns the partial artifact for it. This artifact is incomplete and still needs to be resolved. | ||
| 70 | |||
| 71 | =head1 AUTHOR | ||
| 72 | |||
| 73 | Andrew Sterling Hanenkamp <hanenkamp@cpan.org> | ||
| 74 | |||
| 75 | =head1 COPYRIGHT AND LICENSE | ||
| 76 | |||
| 77 | This software is copyright (c) 2014 by Qubling Software LLC. | ||
| 78 | |||
| 79 | This is free software; you can redistribute it and/or modify it under | ||
| 80 | the same terms as the Perl 5 programming language system itself. | ||
| 81 | |||
| 82 | =cut | ||