| 1 | package Bolts::Injector::Store::Hash; | ||
| 2 | 1 | $Bolts::Injector::Store::Hash::VERSION = '0.143170'; | |
| 3 | # ABSTRACT: Inject values into a hash | ||
| 4 | |||
| 5 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | with 'Bolts::Injector'; | |
| 8 | |||
| 9 | |||
| 10 | 1 | has name => ( | |
| 11 | is => 'ro', | ||
| 12 | isa => 'Str', | ||
| 13 | lazy_build => 1, | ||
| 14 | ); | ||
| 15 | |||
| 16 | 4 | ▶ | sub _build_name { $_[0]->key } |
|
Subroutine
_build_name: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | |||
| 19 | sub post_inject_value { | ||
| 20 | 4 | ▶ | my ($self, $loc, $value, $hash) = @_; |
|
Subroutine
post_inject_value: called CC=1 SCAR=0.0
Pod
documented
| |||
| 21 | 4 | $hash->{ $self->name } = $value; | |
| 22 | } | ||
| 23 | |||
| 24 | |||
| 25 | 1 | 1; | |
| 26 | |||
| 27 | __END__ | ||
| 28 | |||
| 29 | =pod | ||
| 30 | |||
| 31 | =encoding UTF-8 | ||
| 32 | |||
| 33 | =head1 NAME | ||
| 34 | |||
| 35 | Bolts::Injector::Store::Hash - Inject values into a hash | ||
| 36 | |||
| 37 | =head1 VERSION | ||
| 38 | |||
| 39 | version 0.143170 | ||
| 40 | |||
| 41 | =head1 SYNOPSIS | ||
| 42 | |||
| 43 | use Bolts; | ||
| 44 | |||
| 45 | my $counter = 0; | ||
| 46 | artifact thing => ( | ||
| 47 | builder => sub { +{} }, | ||
| 48 | keys => { | ||
| 49 | counter => builder { ++$counter }, | ||
| 50 | }, | ||
| 51 | ); | ||
| 52 | |||
| 53 | =head1 DESCRIPTION | ||
| 54 | |||
| 55 | This performs injection of a value into a hash. | ||
| 56 | |||
| 57 | =head1 ROLES | ||
| 58 | |||
| 59 | =over | ||
| 60 | |||
| 61 | =item * | ||
| 62 | |||
| 63 | L<Bolts::Injector> | ||
| 64 | |||
| 65 | =back | ||
| 66 | |||
| 67 | =head1 ATTRIBUTES | ||
| 68 | |||
| 69 | =head2 name | ||
| 70 | |||
| 71 | This is the name of the hash key to perform injection upon. | ||
| 72 | |||
| 73 | Defaults to the L<Bolts::Injector/key>. | ||
| 74 | |||
| 75 | =head1 METHODS | ||
| 76 | |||
| 77 | =head2 post_inject_value | ||
| 78 | |||
| 79 | Performs the injection into a hash by key. | ||
| 80 | |||
| 81 | =head1 AUTHOR | ||
| 82 | |||
| 83 | Andrew Sterling Hanenkamp <hanenkamp@cpan.org> | ||
| 84 | |||
| 85 | =head1 COPYRIGHT AND LICENSE | ||
| 86 | |||
| 87 | This software is copyright (c) 2014 by Qubling Software LLC. | ||
| 88 | |||
| 89 | This is free software; you can redistribute it and/or modify it under | ||
| 90 | the same terms as the Perl 5 programming language system itself. | ||
| 91 | |||
| 92 | =cut | ||