This file is indexed.

/usr/share/perl5/Run/Parts/Perl.pm is in librun-parts-perl 0.06-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
package Run::Parts::Perl;

use Modern::Perl;
use autodie;
use Taint::Util;
use Run::Parts::Common;

=encoding utf8

=head1 NAME

Run::Parts::Perl - Pure Perl implementation of Debian's run-parts tool

=head1 VERSION

Version 0.02

=cut

our $VERSION = '0.02';

=head1 SYNOPSIS

Pure Perl reimplementation of basic functionality of Debian's run-parts tool.

run-parts runs all the executable files named within constraints
described below, found in the given directory.  Other files and
directories are silently ignored.

Additionally it can just print the names of the all matching files
(not limited to executables, but ignores blacklisted files like
e.g. backup files), but don't actually run them.

This is useful when functionality or configuration is split over
multiple files in one directory.

This module is not thought to be used directly and its interface may
change. See Run::Parts for a stable user interface.

=head1 FILE NAME CONSTRAINTS

On unix-ish operating systems, the file name (but not the path) must
match ^[-A-Za-z0-9_]+$, i.e. may not contain a dot.

On dos-ish operating systems, the file name without suffix must match
^[-A-Za-z0-9_]+$, i.e. may not contain a dot. The suffix may contain
alphanumeric characters and is not mandatory. The full regular
expression the file name including the suffix must match is
^[-A-Za-z0-9_]+(\.[A-Za-z0-9]+)?$.

Debian's run-parts tool also offers to use alternative regular
expressions as file name constraints. This is not yet implemented in
Run::Parts::Perl.

=cut

# On DOS and Windows, run-parts' regular expressions are not really
# applicable. Allow an arbitrary alphanumerical suffix there.
my $win_suffix = dosish() ? qr/\.[a-z0-9]+/i : qr'';
my $file_re = qr/^[-A-Za-z0-9_]+($win_suffix)?$/;

=head1 METHODS

=head2 new (Constructor)

Creates a new Run::Parts object. Takes one parameter, the directory on
which run-parts should work.

=cut

sub new {
    my $self = {};
    bless($self, shift);
    $self->{dir} = shift;

    return $self;
}

=head2 run_parts_command

Executes the given action with the given parameters

=cut

sub run_parts_command {
    my $self = shift;
    my $rp_cmd = shift // 'run';

    my @result = $self->$rp_cmd(@_);

    return lines(@result);
}

=head2 list

Lists all relevant files in the given directory. Equivalent to
"run-parts --list". Returns an array.

=cut

sub list {
    my $self = shift;
    my $dir = $self->{dir};

    opendir(my $dh, $dir);
    my @list = sort map {
        if (defined($dir) and $dir ne '') {
            "$dir/$_";
        } else {
            $_;
        }
    } grep {
        /$file_re/
    } readdir($dh);
}

=head2 test

Lists all relevant executables in the given directory. Equivalent to
"run-parts --tests". Returns an array.

=cut

sub test {
    my $self = shift;
    my $dir = $self->{dir};

    return grep { -x } $self->list($dir);
}

=head2 run

Executes all relevant executables in the given directory. Equivalent to
"run-parts --tests". Returns an array.

=cut

sub run {
    my $self = shift;
    my $dir = $self->{dir};

    return map {
        untaint($_);
        s(/)(\\)g if dosish();
        my $output = `$_`;
        chomp($output);
        $output;
    } $self->test($dir);
}

=head1 INTERNAL FUNCTIONS

=head2 dosish

Returns true if ran on a dos-ish platform, i.e. MS-DOS, Windows or
OS/2.

=cut

sub dosish {
    return $^O =~ /^(dos|os2|MSWin32)$/;
}

=head1 SEE ALSO

Run::Parts, run-parts(8)


=head1 AUTHOR

Axel Beckert, C<< <abe@deuxchevaux.org> >>


=head1 BUGS

Please report any bugs or feature requests to C<bug-run-parts at
rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Run-Parts>.  I will
be notified, and then you'll automatically be notified of progress on
your bug as I make changes.


=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Run::Parts::Perl


=head1 LICENSE AND COPYRIGHT

Copyright 2013 Axel Beckert.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See L<http://dev.perl.org/licenses/> for more information.

=cut

1; # End of Run::Parts