Run::Parts(3pm)

Run::Parts3pm

Offers functionality of debian's run-parts tool in perl

Usage

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

run-parts runs all the executable files named within constraints described in run-parts(8) and 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;
    ...

Version

version 0.09

Backends

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

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

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

Methods

new (Constructor)

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

run_parts_command

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

list

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

test

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

run

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

concat

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

Code

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

Support

•

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

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

•

AnnoCPAN: Annotated CPAN documentation

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

•

CPAN Ratings

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

•

Search CPAN

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

Releases

6 releases since Debian 8 (Jessie); the text changed 2 times.

  1. 8
  2. 9–10
  3. 11–13

Bugs

Please report any bugs or feature requests to "bug-run-parts at rt.cpan.org", or through the web interface at <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.

Author

Axel Beckert <[email protected]>

From librun-parts-perl 0.09-2.1 in Debian 13 (Trixie). Parsed by carta from the page's man source.