File Coverage

blib/lib/Bolts/Blueprint/ParentBag.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 2 2 100.0
total 11 11 100.0


line stmt bran cond sub pod time code
1             package Bolts::Blueprint::ParentBag;
2             $Bolts::Blueprint::ParentBag::VERSION = '0.143171';
3             # ABSTRACT: Retrieve the artifact's parent as the artifact
4              
5 1     1   648 use Moose;
  1         1  
  1         6  
6              
7             with 'Bolts::Blueprint::Role::Injector';
8              
9              
10             sub builder {
11 20     20 1 29 my ($self, $bag, $name, %params) = @_;
12 20         47 return $bag;
13             }
14              
15              
16 20     20 1 58 sub exists { 1 }
17              
18             __PACKAGE__->meta->make_immutable;
19              
20             __END__
21              
22             =pod
23              
24             =encoding UTF-8
25              
26             =head1 NAME
27              
28             Bolts::Blueprint::ParentBag - Retrieve the artifact's parent as the artifact
29              
30             =head1 VERSION
31              
32             version 0.143171
33              
34             =head1 SYNOPSIS
35              
36             use Bolts;
37              
38             # Using the usual sugar...
39             artifact thing => (
40             ...
41             parameters => {
42             parent => self,
43             },
44             );
45              
46             # Or directly...
47             my $meta = Bolts::Bag->start_bag;
48              
49             my $artifact = Bolts::Artifact->new(
50             ...
51             injectors => [
52             $meta->locator->acquire('injector', 'parameter_name', {
53             key => 'parent',
54             blueprint => $meta->locator->acquire('blueprint', 'parent_bag'),
55             }),
56             ],
57             );
58              
59             =head1 DESCRIPTION
60              
61             This is a blueprint for grabing the parent itself as the artifact.
62              
63             B<Warning:> If you cache this object with a scope, like "singleton", your application will leak memory. This may create a very difficult to track loop of references.
64              
65             =head1 ROLES
66              
67             =over
68              
69             =item *
70              
71             L<Bolts::Blueprint::Role::Injector>
72              
73             =back
74              
75             =head1 METHODS
76              
77             =head2 builder
78              
79             This grabs the parent bag and returns it.
80              
81             =head2 exists
82              
83             Always returns true.
84              
85             =head1 AUTHOR
86              
87             Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
88              
89             =head1 COPYRIGHT AND LICENSE
90              
91             This software is copyright (c) 2014 by Qubling Software LLC.
92              
93             This is free software; you can redistribute it and/or modify it under
94             the same terms as the Perl 5 programming language system itself.
95              
96             =cut