/usr/share/perl5/Pod/Weaver.pm is in libpod-weaver-perl 4.012-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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | package Pod::Weaver;
# ABSTRACT: weave together a Pod document from an outline
$Pod::Weaver::VERSION = '4.012';
use Moose;
use namespace::autoclean;
#pod =head1 SYNOPSIS
#pod
#pod my $weaver = Pod::Weaver->new_with_default_config;
#pod
#pod my $document = $weaver->weave_document({
#pod pod_document => $pod_elemental_document,
#pod ppi_document => $ppi_document,
#pod
#pod license => $software_license,
#pod version => $version_string,
#pod authors => \@author_names,
#pod })
#pod
#pod =head1 DESCRIPTION
#pod
#pod Pod::Weaver is a system for building Pod documents from templates. It doesn't
#pod perform simple text substitution, but instead builds a
#pod Pod::Elemental::Document. Its plugins sketch out a series of sections
#pod that will be produced based on an existing Pod document or other provided
#pod information.
#pod
#pod =cut
use File::Spec;
use Log::Dispatchouli 1.100710; # proxy
use Pod::Elemental 0.100220;
use Pod::Elemental::Document;
use Pod::Weaver::Config::Finder;
use Pod::Weaver::Role::Plugin;
use String::Flogger 1;
#pod =attr logger
#pod
#pod This attribute stores the logger, which must provide a log method. The
#pod weaver's log method delegates to the logger's log method.
#pod
#pod =cut
has logger => (
is => 'ro',
lazy => 1,
default => sub {
Log::Dispatchouli->new({
ident => 'Pod::Weaver',
to_stdout => 1,
log_pid => 0,
});
},
handles => [ qw(log log_fatal log_debug) ]
);
#pod =attr plugins
#pod
#pod This attribute is an arrayref of objects that can perform the
#pod L<Pod::Weaver::Role::Plugin> role. In general, its contents are found through
#pod the C<L</plugins_with>> method.
#pod
#pod =cut
has plugins => (
is => 'ro',
isa => 'ArrayRef[Pod::Weaver::Role::Plugin]',
required => 1,
lazy => 1,
init_arg => undef,
default => sub { [] },
);
#pod =method plugins_with
#pod
#pod my $plugins_array_ref = $weaver->plugins_with('-Section');
#pod
#pod This method will return an arrayref of plugins that perform the given role, in
#pod the order of their registration. If the role name begins with a hyphen, the
#pod method will prepend C<Pod::Weaver::Role::>.
#pod
#pod =cut
sub plugins_with {
my ($self, $role) = @_;
$role =~ s/^-/Pod::Weaver::Role::/;
my @plugins = grep { $_->does($role) } @{ $self->plugins };
return \@plugins;
}
#pod =method weave_document
#pod
#pod my $document = $weaver->weave_document(\%input);
#pod
#pod This is the most important method in Pod::Weaver. Given a set of input
#pod parameters, it will weave a new document. Different section plugins will
#pod expect different input parameters to be present, but some common ones include:
#pod
#pod pod_document - a Pod::Elemental::Document for the original Pod document
#pod ppi_document - a PPI document for the source of the module being documented
#pod license - a Software::License object for the source module's license
#pod version - a version (string) to use in produced documentation
#pod
#pod The C<pod_document> should have gone through a L<Pod5
#pod transformer|Pod::Elemental::Transformer::Pod5>, and should probably have had
#pod its C<=head1> elements L<nested|Pod::Elemental::Transformer::Nester>.
#pod
#pod The method will return a new Pod::Elemental::Document. The input documents may
#pod be destructively altered during the weaving process. If they should be
#pod untouched, pass in copies.
#pod
#pod =cut
sub weave_document {
my ($self, $input) = @_;
my $document = Pod::Elemental::Document->new;
for (@{ $self->plugins_with(-Preparer) }) {
$_->prepare_input($input);
}
for (@{ $self->plugins_with(-Dialect) }) {
$_->translate_dialect($input->{pod_document});
}
for (@{ $self->plugins_with(-Transformer) }) {
$_->transform_document($input->{pod_document});
}
for (@{ $self->plugins_with(-Section) }) {
$_->weave_section($document, $input);
}
for (@{ $self->plugins_with(-Finalizer) }) {
$_->finalize_document($document, $input);
}
return $document;
}
#pod =method new_with_default_config
#pod
#pod This method returns a new Pod::Weaver with a stock configuration by using only
#pod L<Pod::Weaver::PluginBundle::Default>.
#pod
#pod =cut
sub new_with_default_config {
my ($class, $arg) = @_;
my $assembler = Pod::Weaver::Config::Assembler->new;
my $root = $assembler->section_class->new({ name => '_' });
$assembler->sequence->add_section($root);
$assembler->change_section('@Default');
$assembler->end_section;
return $class->new_from_config_sequence($assembler->sequence, $arg);
}
sub new_from_config {
my ($class, $arg, $new_arg) = @_;
my $root = $arg->{root} || '.';
my $name = File::Spec->catfile($root, 'weaver');
my ($sequence) = Pod::Weaver::Config::Finder->new->read_config($name);
return $class->new_from_config_sequence($sequence, $new_arg);
}
sub new_from_config_sequence {
my ($class, $seq, $arg) = @_;
$arg ||= {};
my $merge = $arg->{root_config} || {};
confess("config must be a Config::MVP::Sequence")
unless $seq and $seq->isa('Config::MVP::Sequence');
my $core_config = $seq->section_named('_')->payload;
my $self = $class->new({
%$merge,
%$core_config,
});
for my $section ($seq->sections) {
next if $section->name eq '_';
my ($name, $plugin_class, $arg) = (
$section->name,
$section->package,
$section->payload,
);
# $self->log("initializing plugin $name ($plugin_class)");
confess "arguments attempted to override 'plugin_name'"
if defined $arg->{plugin_name};
confess "arguments attempted to override 'weaver'"
if defined $arg->{weaver};
push @{ $self->plugins },
$plugin_class->new({
%$arg,
plugin_name => $name,
weaver => $self,
});
}
return $self;
}
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Pod::Weaver - weave together a Pod document from an outline
=head1 VERSION
version 4.012
=head1 SYNOPSIS
my $weaver = Pod::Weaver->new_with_default_config;
my $document = $weaver->weave_document({
pod_document => $pod_elemental_document,
ppi_document => $ppi_document,
license => $software_license,
version => $version_string,
authors => \@author_names,
})
=head1 DESCRIPTION
Pod::Weaver is a system for building Pod documents from templates. It doesn't
perform simple text substitution, but instead builds a
Pod::Elemental::Document. Its plugins sketch out a series of sections
that will be produced based on an existing Pod document or other provided
information.
=head1 ATTRIBUTES
=head2 logger
This attribute stores the logger, which must provide a log method. The
weaver's log method delegates to the logger's log method.
=head2 plugins
This attribute is an arrayref of objects that can perform the
L<Pod::Weaver::Role::Plugin> role. In general, its contents are found through
the C<L</plugins_with>> method.
=head1 METHODS
=head2 plugins_with
my $plugins_array_ref = $weaver->plugins_with('-Section');
This method will return an arrayref of plugins that perform the given role, in
the order of their registration. If the role name begins with a hyphen, the
method will prepend C<Pod::Weaver::Role::>.
=head2 weave_document
my $document = $weaver->weave_document(\%input);
This is the most important method in Pod::Weaver. Given a set of input
parameters, it will weave a new document. Different section plugins will
expect different input parameters to be present, but some common ones include:
pod_document - a Pod::Elemental::Document for the original Pod document
ppi_document - a PPI document for the source of the module being documented
license - a Software::License object for the source module's license
version - a version (string) to use in produced documentation
The C<pod_document> should have gone through a L<Pod5
transformer|Pod::Elemental::Transformer::Pod5>, and should probably have had
its C<=head1> elements L<nested|Pod::Elemental::Transformer::Nester>.
The method will return a new Pod::Elemental::Document. The input documents may
be destructively altered during the weaving process. If they should be
untouched, pass in copies.
=head2 new_with_default_config
This method returns a new Pod::Weaver with a stock configuration by using only
L<Pod::Weaver::PluginBundle::Default>.
=head1 AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
=head1 CONTRIBUTORS
=for stopwords Alex Peters Apocalypse Blabos de Blebe Caleb Cushing Christian Walde Christopher J. Madsen Chris Weyl Dave Rolsky David E. Wheeler Golden Florian Ragwitz Jonathan "Duke" Leto Joshua Keroes Karen Etheridge Kent Fredric Marcel Gruenauer Randy Stauner Sam Graham Shlomi Fish
=over 4
=item *
Alex Peters <lxp@cpan.org>
=item *
Apocalypse <perl@0ne.us>
=item *
Blabos de Blebe <blabos@cpan.org>
=item *
Caleb Cushing <xenoterracide@gmail.com>
=item *
Christian Walde <walde.christian@googlemail.com>
=item *
Christopher J. Madsen <perl@cjmweb.net>
=item *
Chris Weyl <cweyl@alumni.drew.edu>
=item *
Dave Rolsky <autarch@urth.org>
=item *
David E. Wheeler <david@justatheory.com>
=item *
David Golden <dagolden@cpan.org>
=item *
Florian Ragwitz <rafl@debian.org>
=item *
Jonathan "Duke" Leto <jonathan@leto.net>
=item *
Joshua Keroes <joshua.keroes@integratelecom.com>
=item *
Karen Etheridge <ether@cpan.org>
=item *
Kent Fredric <kentfredric@gmail.com>
=item *
Marcel Gruenauer <hanekomu@gmail.com>
=item *
Randy Stauner <randy@magnificent-tears.com>
=item *
Sam Graham <git@illusori.co.uk>
=item *
Shlomi Fish <shlomif@shlomifish.org>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2015 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
|