line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bread::Board::Service::Alias; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
3
|
|
|
|
|
|
|
# ABSTRACT: aliases another service |
4
|
|
|
|
|
|
|
$Bread::Board::Service::Alias::VERSION = '0.35'; |
5
|
53
|
|
|
53
|
|
370
|
use Moose; |
|
53
|
|
|
|
|
139
|
|
|
53
|
|
|
|
|
414
|
|
6
|
|
|
|
|
|
|
|
7
|
53
|
|
|
53
|
|
372681
|
use Try::Tiny; |
|
53
|
|
|
|
|
145
|
|
|
53
|
|
|
|
|
12792
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has aliased_from_path => ( |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
isa => 'Str', |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has aliased_from => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
does => 'Bread::Board::Service', |
17
|
|
|
|
|
|
|
lazy => 1, |
18
|
|
|
|
|
|
|
builder => '_build_aliased_from', |
19
|
|
|
|
|
|
|
handles => ['get'], # is this sufficient? |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
with 'Bread::Board::Service'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _build_aliased_from { |
25
|
24
|
|
|
24
|
|
60
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
24
|
|
|
|
|
933
|
my $path = $self->aliased_from_path; |
28
|
24
|
50
|
|
|
|
84
|
confess "Can't create an alias service without a service to alias from" |
29
|
|
|
|
|
|
|
unless $path; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
return try { |
32
|
24
|
|
|
24
|
|
1487
|
$self->fetch($path); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
catch { |
35
|
1
|
|
|
1
|
|
852
|
die "While resolving alias " . $self->name . ": $_"; |
36
|
24
|
|
|
|
|
251
|
}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
40
|
|
|
|
|
|
|
|
41
|
53
|
|
|
53
|
|
405
|
no Moose; 1; |
|
53
|
|
|
|
|
135
|
|
|
53
|
|
|
|
|
291
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding UTF-8 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Bread::Board::Service::Alias - aliases another service |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
version 0.35 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This L<service|Bread::Board::Service> class implements |
60
|
|
|
|
|
|
|
L<aliases|Bread::Board/alias ($service_name, $service_path, |
61
|
|
|
|
|
|
|
%service_description)>. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 C<aliased_from_path> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Read-only string attribute, the path of the service this alias refers |
68
|
|
|
|
|
|
|
to (it can be an alias itself) |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 C<aliased_from> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Lazy read-only attribute, built by calling L<< |
73
|
|
|
|
|
|
|
C<fetch>|Bread::Board::Traversable/fetch >> on this service using the |
74
|
|
|
|
|
|
|
L</aliased_from_path> as path to fetch |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Stevan Little <stevan@iinteractive.com> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 BUGS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
83
|
|
|
|
|
|
|
https://github.com/stevan/BreadBoard/issues |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
86
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
87
|
|
|
|
|
|
|
feature. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This software is copyright (c) 2017, 2016, 2015, 2014, 2013, 2011, 2009 by Infinity Interactive. |
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 |