| 1 | package Bolts::Meta::Initializer; | ||||||||||||||||||||||||||||
| 2 | 10 | $Bolts::Meta::Initializer::VERSION = '0.143170'; | |||||||||||||||||||||||||||
| 3 | # ABSTRACT: Store a path and parameters for acquisition | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 10 | has path => ( | |||||||||||||||||||||||||||
| 9 | is => 'ro', | ||||||||||||||||||||||||||||
| 10 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 11 | required => 1, | ||||||||||||||||||||||||||||
| 12 | traits => [ 'Array' ], | ||||||||||||||||||||||||||||
| 13 | handles => { list_path => 'elements' }, | ||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 10 | has parameters => ( | |||||||||||||||||||||||||||
| 18 | is => 'ro', | ||||||||||||||||||||||||||||
| 19 | isa => 'HashRef', | ||||||||||||||||||||||||||||
| 20 | required => 1, | ||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | sub BUILDARGS { | ||||||||||||||||||||||||||||
| 25 | 2 | ▶ | my ($self, @path) = @_; | ||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 2 | my $parameters = {}; | |||||||||||||||||||||||||||
| 28 | 2 | ▶ | if (@path > 1 and ref $path[-1]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@path > 1 and ref $path[-1]
MC/DC50%1/2
@path > 1 and ref $path[-1]
@path > 1
ref $path[-1]
Truth table66%2/3
A and B
A= @path > 1B= ref $path[-1]
| |||||||||||||||||||||||||||||
| 29 | 1 | $parameters = pop @path; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | return { | ||||||||||||||||||||||||||||
| 33 | 2 | path => \@path, | |||||||||||||||||||||||||||
| 34 | parameters => $parameters, | ||||||||||||||||||||||||||||
| 35 | }; | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | sub get { | ||||||||||||||||||||||||||||
| 40 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 41 | 2 | return ($self->list_path, $self->parameters); | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 10 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =pod | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =head1 NAME | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | Bolts::Meta::Initializer - Store a path and parameters for acquisition | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =head1 VERSION | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | version 0.143170 | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | Describes an initializer, which is just a path and set of parameters used to make a call to L<Bolts::Role::Locator/acquire> within a L<Bolts::Role::Initializer> for any attributed tagged with the C<Bolts::Initializer> trait. | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head2 path | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | This is the path that is passed into the constructor. | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =head2 parameters | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | This is a reference to the hash of parameters passsed into the constructor (or an empty hash if none was passed). | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =head1 METHODS | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head2 new | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | my $init = Bolts::Meta::Initailizer->new(@path, \%parameters); | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | The C<BUILDARGS> for this object has been modified so that the constructor takes arguments in the same form as L<Bolts::Role::Locator/acquire>. | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =head2 get | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | my (@path, \%parameters) = $init->get; | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | Returns the contents of this object in a form that can be passed directly on to L<Bolts::Role::Locator/acquire>. | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | Andrew Sterling Hanenkamp <hanenkamp@cpan.org> | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | This software is copyright (c) 2014 by Qubling Software LLC. | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 97 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =cut | ||||||||||||||||||||||||||||