Bolts/Injector/Parameter/ByName.pm

filter: Statementstmt 100% 11 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 100% 15 / 15 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
_build_name
1.0
pre_inject_value
1.0
CRAP 1.0
« Bolts/Inference.pm ↑ Summary Bolts/Injector/Parameter/ByPosition.pm »
1 package Bolts::Injector::Parameter::ByName;
2 10 $Bolts::Injector::Parameter::ByName::VERSION = '0.143170';
3 # ABSTRACT: Inject parameters by name during construction
4  
5 10 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 with 'Bolts::Injector';
8  
9  
10 10 has name => (
11 is => 'ro',
12 isa => 'Str',
13 lazy_build => 1,
14 );
15  
16 57 ▶sub _build_name { $_[0]->key }
Subroutine _build_name: called CC=1 SCAR=0.0
17  
18  
19 sub pre_inject_value {
20 524 ▶ my ($self, $loc, $value, $params) = @_;
Subroutine pre_inject_value: called CC=1 SCAR=0.0
Pod documented
21 524 push @{ $params }, $self->name, $value;
22 }
23  
24 10 __PACKAGE__->meta->make_immutable;
25  
26 __END__
27  
28 =pod
29  
30 =encoding UTF-8
31  
32 =head1 NAME
33  
34 Bolts::Injector::Parameter::ByName - Inject parameters by name during construction
35  
36 =head1 VERSION
37  
38 version 0.143170
39  
40 =head1 SYNOPSIS
41  
42 use Bolts;
43  
44 artifact thing => (
45 class => 'MyApp::Thing',
46 parameters => {
47 foo => dep('other_thing'),
48 },
49 );
50  
51 =head1 DESCRIPTION
52  
53 Inject parameters by name during construction.
54  
55 =head1 ROLES
56  
57 =over
58  
59 =item *
60  
61 L<Bolts::Injector>
62  
63 =back
64  
65 =head1 ATTRIBUTES
66  
67 =head2 name
68  
69 This is the name of the parameter to set in the call to the constructor.
70  
71 =head1 METHODS
72  
73 =head2 pre_inject_value
74  
75 Performs the pre-injection by named parameter.
76  
77 =head1 AUTHOR
78  
79 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
80  
81 =head1 COPYRIGHT AND LICENSE
82  
83 This software is copyright (c) 2014 by Qubling Software LLC.
84  
85 This is free software; you can redistribute it and/or modify it under
86 the same terms as the Perl 5 programming language system itself.
87  
88 =cut
« Bolts/Inference.pm ↑ Summary Bolts/Injector/Parameter/ByPosition.pm »