| 1 | 3 | ▶ | use 5.14.0; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | package Dist::Iller::DocType::Weaver; | ||||||||||||||||||
| 6 | |||||||||||||||||||
| 7 | 3 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |||||||||||||||||
| 8 | # ABSTRACT: Turn the Dist::Iller config into a weaver.ini file | ||||||||||||||||||
| 9 | 3 | our $VERSION = '0.1411'; | |||||||||||||||||
| 10 | |||||||||||||||||||
| 11 | 3 | ▶ | use Dist::Iller::Elk; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 12 | 3 | with qw/ | |||||||||||||||||
| 13 | Dist::Iller::DocType | ||||||||||||||||||
| 14 | Dist::Iller::Role::HasPlugins | ||||||||||||||||||
| 15 | /; | ||||||||||||||||||
| 16 | |||||||||||||||||||
| 17 | 6 | ▶ | sub filename { 'weaver.ini' } | ||||||||||||||||
|
Subroutine
filename: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 18 | |||||||||||||||||||
| 19 | 9 | ▶ | sub phase { 'before' } | ||||||||||||||||
|
Subroutine
phase: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | 6 | ▶ | sub comment_start { ';' } | ||||||||||||||||
|
Subroutine
comment_start: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 22 | |||||||||||||||||||
| 23 | 4 | ▶ | sub parse { | ||||||||||||||||
|
Subroutine
parse: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 24 | 4 | my $self = shift; | |||||||||||||||||
| 25 | 4 | my $yaml = shift; | |||||||||||||||||
| 26 | 4 | $self->parse_plugins($yaml->{'plugins'}); | |||||||||||||||||
| 27 | } | ||||||||||||||||||
| 28 | |||||||||||||||||||
| 29 | 1 | ▶ | sub to_hash { | ||||||||||||||||
|
Subroutine
to_hash: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 30 | 1 | my $self = shift; | |||||||||||||||||
| 31 | |||||||||||||||||||
| 32 | return { | ||||||||||||||||||
| 33 | 1 | plugins => $self->plugins_to_hash, | |||||||||||||||||
| 34 | } | ||||||||||||||||||
| 35 | } | ||||||||||||||||||
| 36 | |||||||||||||||||||
| 37 | 2 | ▶ | sub to_string { | ||||||||||||||||
|
Subroutine
to_string: called CC=2 SCAR=6.9
| |||||||||||||||||||
| 38 | 2 | my $self = shift; | |||||||||||||||||
| 39 | |||||||||||||||||||
| 40 | 2 | my @strings = (); | |||||||||||||||||
| 41 | 2 | foreach my $plugin ($self->all_plugins) { | |||||||||||||||||
| 42 | 31 | push @strings => $plugin->to_string, ''; | |||||||||||||||||
| 43 | } | ||||||||||||||||||
| 44 | 2 | return join "\n" => @strings; | |||||||||||||||||
| 45 | } | ||||||||||||||||||
| 46 | |||||||||||||||||||
| 47 | 4 | ▶ | sub packages_for_plugin { | ||||||||||||||||
|
Subroutine
packages_for_plugin: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 48 | |||||||||||||||||||
| 49 | 62 | ▶ | return sub { | ||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||
| 50 | 62 | my $plugin = shift; | |||||||||||||||||
| 51 | |||||||||||||||||||
| 52 | 62 | my $packages = []; | |||||||||||||||||
| 53 | # For -Transformer | ||||||||||||||||||
| 54 | 62 | ▶ | if($plugin->has_base) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 55 | 34 | ▶ | if($plugin->in eq 'Elemental') { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 56 | 2 | my $base = $plugin->base; | |||||||||||||||||
| 57 | 2 | $base =~ s{^[^a-zA-Z]}{}; | |||||||||||||||||
| 58 | |||||||||||||||||||
| 59 | 2 | push @{ $packages } => { version => $plugin->version, package => sprintf 'Pod::Elemental::%s::%s', $base, $plugin->plugin_name }; | |||||||||||||||||
| 60 | 2 | push @{ $packages } => { version => 0, package => "Pod::Weaver::Plugin::$base" }; | |||||||||||||||||
| 61 | 2 | return $packages; | |||||||||||||||||
| 62 | } | ||||||||||||||||||
| 63 | } | ||||||||||||||||||
| 64 | 60 | ▶ | my $name = $plugin->has_base ? $plugin->base : $plugin->plugin_name; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 65 | 60 | $name =~ m{^(.)}; | |||||||||||||||||
| 66 | 60 | my $first = $1; | |||||||||||||||||
| 67 | |||||||||||||||||||
| 68 | 60 | my $clean_name = $name; | |||||||||||||||||
| 69 | 60 | $clean_name =~ s{^[-%=@]}{}; | |||||||||||||||||
| 70 | |||||||||||||||||||
| 71 | 60 | ▶ | push @{ $packages } => $first eq '-' ? { version => $plugin->version, package => sprintf 'Pod::Weaver::Plugin::%s', $clean_name } | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 72 | : $first eq '@' ? { version => $plugin->version, package => sprintf 'Pod::Weaver::PluginBundle::%s', $clean_name } | ||||||||||||||||||
| 73 | : $first eq '=' ? { version => $plugin->version, package => sprintf $clean_name } | ||||||||||||||||||
| 74 | : { version => $plugin->version, package => sprintf 'Pod::Weaver::Section::%s', $clean_name } | ||||||||||||||||||
| 75 | ; | ||||||||||||||||||
| 76 | 60 | return $packages; | |||||||||||||||||
| 77 | 4 | }; | |||||||||||||||||
| 78 | } | ||||||||||||||||||
| 79 | |||||||||||||||||||
| 80 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||
| 81 | |||||||||||||||||||
| 82 | 3 | 1; | |||||||||||||||||
| 83 | |||||||||||||||||||
| 84 | __END__ | ||||||||||||||||||