This file is indexed.

/usr/share/perl5/Run/Parts.pm is in librun-parts-perl 0.09-2.

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
package Run::Parts;

# ABSTRACT: Offers functionality of Debian's run-parts tool in Perl

use strict;
use warnings;
use 5.010;

use File::Slurp 9999.17;
use Run::Parts::Common;

our $VERSION = '0.09'; # VERSION generated by DZP::OurPkgVersion


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

    my $backend = shift;
    if (defined $backend) {
        if (ref $backend) {
            $self->{backend} = ref($backend)->new($self->{dir});
        } elsif ($backend eq 'debian' or $backend eq 'run-parts') {
            use Run::Parts::Debian;
            $self->{backend} = Run::Parts::Debian->new($self->{dir});
        } elsif ($backend eq 'perl' or $backend eq 'module') {
            use Run::Parts::Perl;
            $self->{backend} = Run::Parts::Perl->new($self->{dir});
        } else {
            warn "Unknown backend $backend in use";
            require $backend;
            # uncoverable statement
            $self->{backend} = $backend->new($self->{dir});
        }
    } else {
        # uncoverable branch false
        if (-x '/bin/run-parts') {
            $self->{backend} = Run::Parts::Debian->new($self->{dir});
        } else {
            # uncoverable statement
            $self->{backend} = Run::Parts::Perl->new($self->{dir});
        }
    }

    return $self;
}


sub run_parts_command {
    my $self = shift;
    return $self->{backend}->run_parts_command(@_);
}


sub list {
    my $self = shift;
    return $self->run_parts_command('list');
}


sub test {
    my $self = shift;
    return $self->run_parts_command('test');
}


sub run {
    my $self = shift;
    return $self->run_parts_command();
}


sub concat {
    my $self = shift;
    return lines(map { read_file($_, { chomp => 1 }) } $self->list());
}


42; # End of Run::Parts

__END__

=pod

=encoding UTF-8

=head1 NAME

Run::Parts - Offers functionality of Debian's run-parts tool in Perl

=head1 VERSION

version 0.09

=head1 SYNOPSIS

Run::Parts offers functionality of Debian's L<run-parts(8)> tool in
Perl.

run-parts runs all the executable files named within constraints
described in L<run-parts(8)> and L<Run::Parts::Perl>, 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. A typical convention is that the
directory name ends in ".d". Common examples for such split
configuration directories:

    /etc/cron.d/
    /etc/apt/apt.conf.d/
    /etc/apt/sources.list.d/,
    /etc/aptitude-robot/pkglist.d/
    /etc/logrotate.d/
    /etc/rsyslog.d/

Perhaps a little code snippet.

    use Run::Parts;

    my $rp  = Run::Parts->new('directory'); # chooses backend automatically
    my $rpp = Run::Parts->new('directory', 'perl'); # pure perl backend
    my $rpd = Run::Parts->new('directory', 'debian'); # uses /bin/run-parts

    my @file_list        = $rp->list;
    my @executables_list = $rpp->test;
    my $commands_output  = $rpd->run;
    ...

=begin readme

=head1 INSTALLATION

To install this module, run the following commands:

    perl Build.PL
    ./Build
    ./Build test
    ./Build install

=end readme

=head1 BACKENDS

L<Run::Parts> contains two backend implementations.
L<Run::Parts::Debian> actually uses /bin/run-parts and
L<Run::Parts::Perl> is a pure Perl implementation of a basic set of
L<run-parts(8)>' functionality.

L<Run::Parts::Debian> may or may not work with RedHat's simplified
shell-script based reimplementation of Debian's L<run-parts(8)>.

By default L<Run::Parts> uses L<Run::Parts::Debian> if /bin/run-parts
exists, L<Run::Parts::Perl> otherwise. But you can also choose any of
the backends explicitly.

=for readme stop

=head1 METHODS

=head2 new (Constructor)

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

=head2 run_parts_command

Returns the L<run-parts(8)> command to run with the given command
parameter.

=head2 list

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

=head2 test

Lists all relevant executables in the given directory. Equivalent to
"run-parts --test".

=head2 run

Runs all relevant executables in the given directory. Equivalent to
"run-parts".

=head2 concat

Returns the concatenated contents of all relevant files in the given
directory. Equivalent to "cat `run-parts --list`".

=for readme continue

=head1 SEE ALSO

L<run-parts(8)>, L<Run::Parts::Debian>, L<Run::Parts::Perl>

=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 CODE

You can find a git repository of Run::Parts' code at
L<https://github.com/xtaran/run-parts>.

=head1 SUPPORT

=begin readme

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

    perldoc Run::Parts


You can also look for information at:

=end readme

=over 4

=item * RT: CPAN's request tracker (report bugs here)

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Run-Parts>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Run-Parts>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/Run-Parts>

=item * Search CPAN

L<http://search.cpan.org/dist/Run-Parts/>

=back

=head1 AUTHOR

Axel Beckert <abe@deuxchevaux.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Axel Beckert.

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