/usr/share/perl5/Pod/Coverage/TrustPod.pm is in libpod-coverage-trustpod-perl 0.100003-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 | use strict;
use warnings;
package Pod::Coverage::TrustPod;
{
$Pod::Coverage::TrustPod::VERSION = '0.100003';
}
use base 'Pod::Coverage::CountParents';
# ABSTRACT: allow a module's pod to contain Pod::Coverage hints
use Pod::Find qw(pod_where);
use Pod::Eventual::Simple;
sub __get_pod_trust {
my ($self, $package, $collect) = @_;
my @parents;
{
no strict 'refs';
@parents = @{"$package\::ISA"};
}
return $collect unless my $file = pod_where( { -inc => 1 }, $package );
my $output = Pod::Eventual::Simple->read_file($file);
my @hunks = grep {;
no warnings 'uninitialized';
((($_->{command} eq 'begin' and $_->{content} =~ /^Pod::Coverage\b/)
...
($_->{command} eq 'end' and $_->{content} =~ /^Pod::Coverage\b/))
and $_->{type} =~ m{\Averbatim|text\z})
or
$_->{command} eq 'for' and $_->{content} =~ s/^Pod::Coverage\b//
} @$output;
my @trusted =
grep { s/^\s+//; s/\s+$//; /\S/ }
map { split /\s/m, $_->{content} } @hunks;
$collect->{$_} = 1 for @trusted;
$self->__get_pod_trust($_, $collect) for @parents;
return $collect;
}
sub _trustme_check {
my ($self, $sym) = @_;
my $from_pod = $self->{_trust_from_pod} ||= $self->__get_pod_trust(
$self->{package},
{}
);
return 1 if $from_pod->{'*EVERYTHING*'};
return 1 if $self->SUPER::_trustme_check($sym);
return 1 if grep { $sym =~ /\A$_\z/ } keys %$from_pod;
return;
}
1;
__END__
=pod
=head1 NAME
Pod::Coverage::TrustPod - allow a module's pod to contain Pod::Coverage hints
=head1 VERSION
version 0.100003
=head1 DESCRIPTION
This is a Pod::Coverage subclass (actually, a subclass of
Pod::Coverage::CountParents) that allows the POD itself to declare certain
symbol names trusted.
Here is a sample Perl module:
package Foo::Bar;
=head1 NAME
Foo::Bar - a bar at which fooes like to drink
=head1 METHODS
=head2 fee
returns the bar tab
=cut
sub fee { ... }
=head2 fie
scoffs at bar tab
=cut
sub fie { ... }
sub foo { ... }
=begin Pod::Coverage
foo
=end Pod::Coverage
=cut
This file would report full coverage, because any non-empty lines inside a
block of POD targeted to Pod::Coverage are treated as C<trustme> patterns.
Leading and trailing whitespace is stripped and the remainder is treated as a
regular expression anchored at both ends.
Remember, anywhere you could use C<=begin> and C<=end> as above, you could
instead write:
=for Pod::Coverage foo
In some cases, you may wish to make the entire file trusted. The special
pattern C<*EVERYTHING*> may be provided to do just this.
Keep in mind that Pod::Coverage::TrustPod sets up exceptions using the "trust"
mechanism rather than the "privacy" mechanism in Pod::Coverage. This is
unlikely ever to matter to you, but it's true.
=head1 AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 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
|