line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bread::Board::SetterInjection; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
3
|
|
|
|
|
|
|
# ABSTRACT: service instantiating objects via setter functions |
4
|
|
|
|
|
|
|
$Bread::Board::SetterInjection::VERSION = '0.37'; |
5
|
55
|
|
|
55
|
|
165492
|
use Moose; |
|
55
|
|
|
|
|
270292
|
|
|
55
|
|
|
|
|
474
|
|
6
|
|
|
|
|
|
|
|
7
|
55
|
|
|
55
|
|
366493
|
use Bread::Board::Types; |
|
55
|
|
|
|
|
148
|
|
|
55
|
|
|
|
|
7835
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Bread::Board::Service::WithConstructor', |
10
|
|
|
|
|
|
|
'Bread::Board::Service::WithParameters', |
11
|
|
|
|
|
|
|
'Bread::Board::Service::WithDependencies'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has '+class' => (required => 1); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get { |
16
|
|
|
|
|
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
my $constructor = $self->constructor_name; |
18
|
|
|
|
|
|
|
my $o = $self->class->$constructor(); |
19
|
|
|
|
|
|
|
$o->$_($self->param($_)) foreach $self->param; |
20
|
|
|
|
|
|
|
return $o; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
24
|
|
|
|
|
|
|
|
25
|
55
|
|
|
55
|
|
445
|
no Moose; 1; |
|
55
|
|
|
|
|
144
|
|
|
55
|
|
|
|
|
336
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=encoding UTF-8 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Bread::Board::SetterInjection - service instantiating objects via setter functions |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 VERSION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
version 0.37 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This L<service|Bread::Board::Service> class instantiates objects by |
44
|
|
|
|
|
|
|
calling C<new> on a class, then calling setters on the returned |
45
|
|
|
|
|
|
|
object. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This class consumes L<Bread::Board::Service::WithClass>, |
48
|
|
|
|
|
|
|
L<Bread::Board::Service::WithParameters>, |
49
|
|
|
|
|
|
|
L<Bread::Board::Service::WithDependencies>. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 C<class> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Attribute provided by L<Bread::Board::Service::WithClass>. This |
56
|
|
|
|
|
|
|
service makes it a required attribute: you can't call a constructor if |
57
|
|
|
|
|
|
|
you don't have a class. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 METHODS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 C<get> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Calls the C<new> method on the L</class> to get the object to return; |
64
|
|
|
|
|
|
|
then, for each of the L<service |
65
|
|
|
|
|
|
|
parameters|Bread::Board::Service/params>, calls a setter with the same |
66
|
|
|
|
|
|
|
name as the parameter, passing it the parameter's value. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHOR |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Stevan Little <stevan@iinteractive.com> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 BUGS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
75
|
|
|
|
|
|
|
https://github.com/stevan/BreadBoard/issues |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
78
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
79
|
|
|
|
|
|
|
feature. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This software is copyright (c) 2019, 2017, 2016, 2015, 2014, 2013, 2011, 2009 by Infinity Interactive. |
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 |