line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: document builder - links |
2
|
|
|
|
|
|
|
package PONAPI::Builder::Links; |
3
|
|
|
|
|
|
|
|
4
|
34
|
|
|
34
|
|
169664
|
use Moose; |
|
34
|
|
|
|
|
331861
|
|
|
34
|
|
|
|
|
230
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'PONAPI::Builder', |
7
|
|
|
|
|
|
|
'PONAPI::Builder::Role::HasMeta'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has _links => ( |
10
|
|
|
|
|
|
|
init_arg => undef, |
11
|
|
|
|
|
|
|
traits => [ 'Hash' ], |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => 'HashRef', |
14
|
|
|
|
|
|
|
lazy => 1, |
15
|
|
|
|
|
|
|
default => sub { +{} }, |
16
|
|
|
|
|
|
|
handles => { |
17
|
|
|
|
|
|
|
'has_links' => 'count', |
18
|
|
|
|
|
|
|
'has_link' => 'exists', |
19
|
|
|
|
|
|
|
'get_link' => 'get', |
20
|
|
|
|
|
|
|
# private ... |
21
|
|
|
|
|
|
|
'_add_link' => 'set', |
22
|
|
|
|
|
|
|
'_keys_links' => 'keys', |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub add_link { |
27
|
426
|
|
|
426
|
0
|
941
|
my ( $self, $rel, $url ) = @_; |
28
|
426
|
|
|
|
|
20258
|
$self->_add_link( $rel => $url ); |
29
|
426
|
|
|
|
|
1166
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub add_links { |
33
|
25
|
|
|
25
|
0
|
106
|
my ( $self, %links ) = @_; |
34
|
25
|
|
|
|
|
159
|
$self->add_link( $_, $links{ $_ } ) foreach keys %links; |
35
|
25
|
|
|
|
|
133
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub build { |
39
|
690
|
|
|
690
|
0
|
1034
|
my $self = $_[0]; |
40
|
690
|
|
|
|
|
1077
|
my $result = {}; |
41
|
|
|
|
|
|
|
|
42
|
690
|
|
|
|
|
32088
|
foreach my $key ( $self->_keys_links ) { |
43
|
931
|
|
|
|
|
42571
|
$result->{ $key } = $self->get_link( $key ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
690
|
100
|
|
|
|
33177
|
$result->{meta} = $self->_meta if $self->has_meta; |
47
|
|
|
|
|
|
|
|
48
|
690
|
|
|
|
|
2383
|
return $result; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
52
|
34
|
|
|
34
|
|
226348
|
no Moose; 1; |
|
34
|
|
|
|
|
77
|
|
|
34
|
|
|
|
|
224
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=encoding UTF-8 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
PONAPI::Builder::Links - document builder - links |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 VERSION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
version 0.002005 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHORS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over 4 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Mickey Nasriachi <mickey@cpan.org> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Stevan Little <stevan@cpan.org> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Brian Fraser <hugmeir@cpan.org> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=back |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Mickey Nasriachi, Stevan Little, Brian Fraser. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
91
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |