This file is indexed.

/usr/share/perl5/MooseX/App/Meta/Role/Class/Documentation.pm is in libmoosex-app-perl 1.37-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
# ============================================================================
package MooseX::App::Meta::Role::Class::Documentation;
# ============================================================================

use utf8;
use 5.010;

use namespace::autoclean;
use Moose::Role;

use Pod::Elemental;
use Pod::Elemental::Selectors qw();
use Pod::Elemental::Transformer::Pod5;
use Pod::Elemental::Transformer::Nester;

has 'command_short_description' => (
    is          => 'rw',
    isa         => 'Maybe[Str]',
    lazy        => 1,
    builder     => '_build_command_short_description',
);

has 'command_long_description' => (
    is          => 'rw',
    isa         => 'Maybe[Str]',
    lazy        => 1,
    builder     => '_build_command_long_description',
);

has 'command_usage' => (
    is          => 'rw',
    isa         => 'Maybe[Str]',
    lazy        => 1,
    builder     => '_build_command_usage',
);

has 'command_strict' => (
    is          => 'rw',
    isa         => 'Bool',
    default     => sub {0},
);

sub command_short_description_predicate {
    my ($self) = @_;
    return $self->_command_pod_predicate('command_short_description');
}

sub _build_command_short_description {
    my ($self) = @_;
    my %pod = $self->_build_command_pod();
    return $pod{'command_short_description'}
        if defined $pod{'command_short_description'};
    return;
}

sub command_long_description_predicate {
    my ($self) = @_;
    return $self->_command_pod_predicate('command_long_description');
}

sub _build_command_long_description {
    my ($self) = @_;
    my %pod = $self->_build_command_pod();
    return $pod{'command_long_description'}
        if defined $pod{'command_long_description'};
    return;
}

sub command_usage_predicate {
    my ($self) = @_;
    return $self->_command_pod_predicate('command_usage');
}

sub _build_command_usage {
    my ($self) = @_;
    my %pod = $self->_build_command_pod();
    return $pod{'command_usage'}
        if defined $pod{'command_usage'};
    return;
}

sub _command_pod_predicate {
    my ($self,$field) = @_;

    my $attribute = $self->meta->find_attribute_by_name($field);

    unless ($attribute->has_value($self)) {
        $self->_build_command_pod($field);
    }

    my $value = $attribute->get_value($self);

    return (defined $value && $value ? 1:0);
}


sub _build_command_pod {
    my ($self) = @_;

    my %pod_raw = MooseX::App::Utils::parse_pod($self->name);

    my %pod = (
        command_usage               => ($pod_raw{SYNOPSIS} || $pod_raw{USAGE}),
        command_long_description    => ($pod_raw{DESCRIPTION} || $pod_raw{OVERVIEW}),
        command_short_description   => ($pod_raw{NAME} || $pod_raw{ABSTRACT}),
    );

    # Loop sections that need to be extracted from POD
    foreach my $key (keys %pod) {
        my $meta_attribute = $self->meta->find_attribute_by_name($key);
        next
            unless defined $meta_attribute;
        next
            if $meta_attribute->has_value($self);
        $meta_attribute->set_raw_value($self,$pod{$key});
    }

    return %pod;
}

#{
#    package Moose::Meta::Class::Custom::Trait::AppCommand;
#    sub register_implementation { return 'MooseX::App::Meta::Role::Class::Documentation' }
#}

1;

__END__

=pod

=encoding utf8

=head1 NAME

MooseX::App::Meta::Role::Class::Documentation - Meta class role for command classes

=head1 DESCRIPTION

This meta class role will automatically be applied to all command classes.
This documentation is only of interest if you intend to write plugins for
MooseX::App.

=head1 ACCESSORS

=head2 command_short_description

Read/set the short command description. Will be extracted from the Pod NAME
or ABSTRACT section if not set. Alternative this will be taken from the
DistZilla ABSTRACT tag.

=head2 command_long_description

Read/set the long command description. Will be extracted from the Pod
DESCRIPTION or OVERVIEW section if not set.

=head2 command_usage

Read/set the long command usage. Will be extracted from the Pod
SYNOPSIS or USAGE section if not set. If these Pod sections are not defined
the usage will be autogenerated.

=head2 command_strict

Read/set the strict command flag. If strict is enabled the command will
terminate with an error message if superfluous/unknown positional parameters
are supplied. If disabled all extra parameters will be copied to the
L<extra_argv> attribute.

The app_strict function in the app classes allows one to set this option
globally.

=head1 METHODS

=head2 _build_command_pod

Parses the Pod from the command class.

=cut