line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bread::Board::Dependency; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
3
|
|
|
|
|
|
|
# ABSTRACT: dependency for a service |
4
|
|
|
|
|
|
|
$Bread::Board::Dependency::VERSION = '0.35'; |
5
|
63
|
|
|
63
|
|
455
|
use Moose; |
|
63
|
|
|
|
|
157
|
|
|
63
|
|
|
|
|
440
|
|
6
|
|
|
|
|
|
|
|
7
|
63
|
|
|
63
|
|
447343
|
use Bread::Board::Service; |
|
63
|
|
|
|
|
168
|
|
|
63
|
|
|
|
|
14780
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Bread::Board::Traversable'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'service_path' => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => 'Str', |
14
|
|
|
|
|
|
|
predicate => 'has_service_path' |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'service_name' => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
isa => 'Str', |
20
|
|
|
|
|
|
|
lazy => 1, |
21
|
|
|
|
|
|
|
default => sub { |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
($self->has_service_path) |
24
|
|
|
|
|
|
|
|| confess "Could not determine service name without service path"; |
25
|
|
|
|
|
|
|
(split '/' => $self->service_path)[-1]; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has 'service_params' => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
isa => 'HashRef', |
32
|
|
|
|
|
|
|
predicate => 'has_service_params' |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has 'service' => ( |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
does => 'Bread::Board::Service | Bread::Board::Dependency', |
38
|
|
|
|
|
|
|
lazy => 1, |
39
|
|
|
|
|
|
|
default => sub { |
40
|
|
|
|
|
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
($self->has_service_path) |
42
|
|
|
|
|
|
|
|| confess "Could not fetch service without service path"; |
43
|
|
|
|
|
|
|
$self->fetch($self->service_path); |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
handles => [ 'get', 'is_locked', 'lock', 'unlock' ] |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
49
|
|
|
|
|
|
|
|
50
|
63
|
|
|
63
|
|
474
|
no Moose; 1; |
|
63
|
|
|
|
|
149
|
|
|
63
|
|
|
|
|
537
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=pod |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=encoding UTF-8 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Bread::Board::Dependency - dependency for a service |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 VERSION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
version 0.35 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This class holds the information for a dependency of a |
69
|
|
|
|
|
|
|
L<service|Bread::Board::Service::WithDependencies>. When L<resolving |
70
|
|
|
|
|
|
|
dependencies|Bread::Board::Service::WithDependencies/resolve_dependencies>, |
71
|
|
|
|
|
|
|
instances of this class will be used to access the services that will |
72
|
|
|
|
|
|
|
provide the depended-on values. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This class consumes the L<Bread::Board::Traversable> role to retrieve |
75
|
|
|
|
|
|
|
services given their path. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 C<service_path> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
The path to use (possibly relative to the dependency itself) to access |
82
|
|
|
|
|
|
|
the L</service>. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 C<service> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
The service this dependency points at. Usually built lazily from the |
87
|
|
|
|
|
|
|
L</service_path>, but could just be passed in to the constructor. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 C<service_name> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Name of the L</service>, defaults to the last element of the |
92
|
|
|
|
|
|
|
L</service_path>. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 METHODS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 C<has_service_path> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Predicate for the L</service_path> attribute. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 C<get> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 C<is_locked> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 C<lock> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 C<unlock> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
These methods are delegated to the L</service>. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHOR |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Stevan Little <stevan@iinteractive.com> |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 BUGS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
117
|
|
|
|
|
|
|
https://github.com/stevan/BreadBoard/issues |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
120
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
121
|
|
|
|
|
|
|
feature. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This software is copyright (c) 2017, 2016, 2015, 2014, 2013, 2011, 2009 by Infinity Interactive. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
128
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |