| 1 | package Pod::Weaver::Section::Author::GETTY::Legal; | ||||||||||
| 2 | # ABSTRACT: Copyright and license section with a link to the author's site | ||||||||||
| 3 | 4 | our $VERSION = '0.328'; | |||||||||
| 4 | 4 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | extends 'Pod::Weaver::Section::Legal'; | |||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | use Pod::Elemental::Element::Nested; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 4 | ▶ | use Pod::Elemental::Element::Pod5::Ordinary; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 4 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | |||||||||||
| 12 | 4 | has url => ( | |||||||||
| 13 | is => 'ro', | ||||||||||
| 14 | isa => 'Str', | ||||||||||
| 15 | default => 'https://raudssus.de/', | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | 65 | ▶ | around weave_section => sub { | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||
| 20 | 65 | my ($orig, $self, $document, $input) = @_; | |||||||||
| 21 | |||||||||||
| 22 | 65 | my $before = scalar @{ $document->children }; | |||||||||
| 23 | 65 | $self->$orig($document, $input); | |||||||||
| 24 | 65 | ▶ | return if @{ $document->children } == $before; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | |||||||||||
| 26 | 65 | my $section = $document->children->[-1]; | |||||||||
| 27 | 65 | my $url = $self->url; | |||||||||
| 28 | 65 | ▶ | return if grep { index($_->content, $url) >= 0 } @{ $section->children }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | |||||||||||
| 30 | 64 | push @{ $section->children }, Pod::Elemental::Element::Pod5::Ordinary->new({ | |||||||||
| 31 | content => "L<$url>", | ||||||||||
| 32 | }); | ||||||||||
| 33 | 4 | }; | |||||||||
| 34 | |||||||||||
| 35 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||
| 36 | |||||||||||
| 37 | 4 | 1; | |||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||