/usr/share/perl5/Pod/Weaver/Plugin/Transformer.pm is in libpod-weaver-perl 4.015-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | package Pod::Weaver::Plugin::Transformer;
# ABSTRACT: apply arbitrary transformers
$Pod::Weaver::Plugin::Transformer::VERSION = '4.015';
use Moose;
with 'Pod::Weaver::Role::Dialect';
use namespace::autoclean;
use Module::Runtime qw(use_module);
use List::MoreUtils qw(part);
use String::RewritePrefix;
#pod =head1 OVERVIEW
#pod
#pod This plugin acts as a L<Pod::Weaver::Role::Dialect> that applies an arbitrary
#pod L<Pod::Elemental::Transformer> to your input document. It is configured like
#pod this:
#pod
#pod [-Transformer / Lists]
#pod transformer = List
#pod format_name = outline
#pod
#pod This will end up creating a transformer like this:
#pod
#pod my $xform = Pod::Elemental::Transformer::List->new({
#pod format_name => 'outline',
#pod });
#pod
#pod and that transformer will then be handed the entire input Pod document.
#pod
#pod =cut
has transformer => (is => 'ro', required => 1);
sub BUILDARGS {
my ($class, @arg) = @_;
my %copy = ref $arg[0] ? %{$arg[0]} : @arg;
my @part = part { /\A\./ ? 0 : 1 } keys %copy;
my %class_args = map { s/\A\.//; $_ => $copy{ ".$_" } } @{ $part[0] };
my %xform_args = map { $_ => $copy{ $_ } } @{ $part[1] };
my $xform_class = String::RewritePrefix->rewrite(
{ '' => 'Pod::Elemental::Transformer::', '=' => '' },
delete $xform_args{transformer},
);
use_module($xform_class);
my $plugin_name = delete $xform_args{plugin_name};
my $weaver = delete $xform_args{weaver};
my $xform = $xform_class->new(\%xform_args);
return {
%class_args,
plugin_name => $plugin_name,
weaver => $weaver,
transformer => $xform,
}
}
sub translate_dialect {
my ($self, $pod_document) = @_;
$self->log_debug('applying transform');
$self->transformer->transform_node( $pod_document );
}
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Pod::Weaver::Plugin::Transformer - apply arbitrary transformers
=head1 VERSION
version 4.015
=head1 OVERVIEW
This plugin acts as a L<Pod::Weaver::Role::Dialect> that applies an arbitrary
L<Pod::Elemental::Transformer> to your input document. It is configured like
this:
[-Transformer / Lists]
transformer = List
format_name = outline
This will end up creating a transformer like this:
my $xform = Pod::Elemental::Transformer::List->new({
format_name => 'outline',
});
and that transformer will then be handed the entire input Pod document.
=head1 AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|