| 1 | # ABSTRACT: document builder - role - links | ||
| 2 | package PONAPI::Builder::Role::HasLinksBuilder; | ||
| 3 | |||
| 4 | 33 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 33 | ▶ | use PONAPI::Builder::Links; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 33 | requires 'add_self_link'; | |
| 9 | |||
| 10 | 33 | has links_builder => ( | |
| 11 | init_arg => undef, | ||
| 12 | is => 'ro', | ||
| 13 | isa => 'PONAPI::Builder::Links', | ||
| 14 | lazy => 1, | ||
| 15 | predicate => 'has_links_builder', | ||
| 16 | builder => '_build_links_builder', | ||
| 17 | handles => [qw[ | ||
| 18 | has_links | ||
| 19 | has_link | ||
| 20 | ]] | ||
| 21 | ); | ||
| 22 | |||
| 23 | 252 | ▶ | sub _build_links_builder { PONAPI::Builder::Links->new( parent => $_[0] ) } |
|
Subroutine
_build_links_builder: called CC=1 SCAR=0.0
| |||
| 24 | |||
| 25 | # NOTE: | ||
| 26 | # These need to be delegated so that they | ||
| 27 | # can return the instance of the Builder | ||
| 28 | # they are attached to and not the Links | ||
| 29 | # Builder itself. | ||
| 30 | # - SL | ||
| 31 | |||
| 32 | sub add_link { | ||
| 33 | 5 | ▶ | my ($self, @args) = @_; |
|
Subroutine
add_link: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 34 | 5 | $self->links_builder->add_link( @args ); | |
| 35 | 5 | return $self; | |
| 36 | } | ||
| 37 | |||
| 38 | sub add_links { | ||
| 39 | 16 | ▶ | my ($self, @args) = @_; |
|
Subroutine
add_links: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 40 | 16 | $self->links_builder->add_links( @args ); | |
| 41 | 16 | return $self; | |
| 42 | } | ||
| 43 | |||
| 44 | 33 | ▶ | no Moose::Role; 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | |||
| 46 | __END__ | ||
| 47 | |||
| 48 | =pod | ||
| 49 | |||
| 50 | =encoding UTF-8 | ||
| 51 | |||
| 52 | =head1 NAME | ||
| 53 | |||
| 54 | PONAPI::Builder::Role::HasLinksBuilder - document builder - role - links | ||
| 55 | |||
| 56 | =head1 VERSION | ||
| 57 | |||
| 58 | version 0.002012 | ||
| 59 | |||
| 60 | =head1 AUTHORS | ||
| 61 | |||
| 62 | =over 4 | ||
| 63 | |||
| 64 | =item * | ||
| 65 | |||
| 66 | Mickey Nasriachi <mickey@cpan.org> | ||
| 67 | |||
| 68 | =item * | ||
| 69 | |||
| 70 | Stevan Little <stevan@cpan.org> | ||
| 71 | |||
| 72 | =item * | ||
| 73 | |||
| 74 | Brian Fraser <hugmeir@cpan.org> | ||
| 75 | |||
| 76 | =back | ||
| 77 | |||
| 78 | =head1 COPYRIGHT AND LICENSE | ||
| 79 | |||
| 80 | This software is copyright (c) 2016 by Mickey Nasriachi, Stevan Little, Brian Fraser. | ||
| 81 | |||
| 82 | This is free software; you can redistribute it and/or modify it under | ||
| 83 | the same terms as the Perl 5 programming language system itself. | ||
| 84 | |||
| 85 | =cut | ||