/usr/share/perl5/Pod/Elemental/Document.pm is in libpod-elemental-perl 0.103001-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 | package Pod::Elemental::Document;
# ABSTRACT: a pod document
$Pod::Elemental::Document::VERSION = '0.103001';
use Moose;
with 'Pod::Elemental::Node';
use Class::Load ();
use Moose::Autobox;
use namespace::autoclean;
use Pod::Elemental::Element::Generic::Blank;
use String::RewritePrefix;
#pod =head1 OVERVIEW
#pod
#pod Pod::Elemental::Document is a container for Pod documents. It performs
#pod L<Pod::Elemental::Node> but I<not> L<Pod::Elemental::Paragraph>.
#pod
#pod Documents are used almost exclusively to give a small amount of behavior to
#pod arrayrefs of paragraphs, and have few methods of their own.
#pod
#pod =cut
sub _expand_name {
my ($self, $name) = @_;
return String::RewritePrefix->rewrite(
{
'' => 'Pod::Elemental::Element::',
'=' => ''
},
$name,
);
}
sub as_pod_string {
my ($self) = @_;
my $str = join q{}, $self->children->map(sub { $_->as_pod_string })->flatten;
$str = "=pod\n\n$str" unless $str =~ /\A=pod\n/;
$str .= "=cut\n" unless $str =~ /=cut\n+\z/;
return $str;
}
sub as_debug_string {
return 'Document'
}
sub _elem_from_lol_entry {
my ($self, $entry) = @_;
my ($type, $content, $arg) = @$entry;
$arg ||= {};
if (! defined $type) {
my $n_class = $self->_expand_name($arg->{class} || 'Generic::Text');
Class::Load::load_class($n_class);
return $n_class->new({ content => "$content\n" });
} elsif ($type =~ /\A=(\w+)\z/) {
my $command = $1;
my $n_class = $self->_expand_name($arg->{class} || 'Generic::Command');
Class::Load::load_class($n_class);
return $n_class->new({
command => $command,
content => "$content\n"
});
} else {
my $n_class = $self->_expand_name($arg->{class} || 'Pod5::Region');
Class::Load::load_class($n_class);
my @children;
for my $child (@$content) {
push @children, $self->_elem_from_lol_entry($child);
} continue {
my $blank = $self->_expand_name('Generic::Blank');
push @children, $blank->new({ content => "\n" });
}
pop @children
while $children[-1]->isa('Pod::Elemental::Element::Generic::Blank');
my ($colon, $target) = $type =~ /\A(:)?(.+)\z/;
return $n_class->new({
format_name => $target,
is_pod => $colon ? 1 : 0,
content => "\n",
children => \@children,
})
}
}
sub new_from_lol {
my ($class, $lol) = @_;
my $self = $class->new;
my @children;
ENTRY: for my $entry (@$lol) {
my $elem = $self->_elem_from_lol_entry($entry);
push @children, $elem;
} continue {
my $blank = $self->_expand_name('Generic::Blank');
push @children, $blank->new({ content => "\n" });
}
push @{ $self->children }, @children;
return $self;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Pod::Elemental::Document - a pod document
=head1 VERSION
version 0.103001
=head1 OVERVIEW
Pod::Elemental::Document is a container for Pod documents. It performs
L<Pod::Elemental::Node> but I<not> L<Pod::Elemental::Paragraph>.
Documents are used almost exclusively to give a small amount of behavior to
arrayrefs of paragraphs, and have few methods of their own.
=head1 AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 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
|