Run::Parts - Offers functionality of Debian's run-parts tool in Perl
Run::Parts offers functionality of Debian's run-parts(8) tool in Perl.
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; ...
Creates a new Run::Parts object. Takes one parameter, the directory on which run-parts should work.
Returns the run-parts(8) command to run with the given command parameter.
Lists all relevant files in the given directory. Equivalent to "run-parts --list".
Lists all relevant executables in the given directory. Equivalent to "run-parts --test".
Runs all relevant executables in the given directory. Equivalent to "run-parts".
Returns the concatenated contents of all relevant files in the given directory. Equivalent to "cat `run-parts --list`".
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.
You can find a git repository of Run::Parts' code at https://github.com/xtaran/run-parts.
Axel Beckert <email@example.com>
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.