File Coverage

blib/lib/Run/Parts/Debian.pm
Criterion Covered Total %
statement 14 14 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 4 4 100.0
pod 2 2 100.0
total 24 25 96.0


line stmt bran cond sub pod time code
1             package Run::Parts::Debian;
2              
3 5     5   29 use Modern::Perl;
  5         10  
  5         39  
4 5     5   748 use Run::Parts::Common;
  5         65  
  5         1172  
5              
6             =encoding utf8
7              
8             =head1 NAME
9              
10             Run::Parts::Debian - Perl interface to Debian's run-parts tool
11              
12             =head1 VERSION
13              
14             Version 0.01
15              
16             =cut
17              
18             our $VERSION = '0.01';
19              
20              
21             =head1 SYNOPSIS
22              
23             Perl interface to Debian's run-parts tool. run-parts runs all the
24             executable files named within constraints described below, found in
25             the given directory. Other files and directories are silently
26             ignored.
27              
28             Additionally it can just print the names of the all matching files
29             (not limited to executables, but ignores blacklisted files like
30             e.g. backup files), but don't actually run them.
31              
32             This is useful when functionality or configuration is split over
33             multiple files in one directory.
34              
35             This module is not thought to be used directly and its interface may
36             change. See Run::Parts for a stable user interface.
37              
38             =head1 METHODS
39              
40             =head2 new (Constructor)
41              
42             Creates a new Run::Parts object. Takes one parameter, the directory on
43             which run-parts should work.
44              
45             =cut
46              
47             sub new {
48 3     3 1 9 my $self = {};
49 3         8 bless($self, shift);
50 3         18 $self->{dir} = shift;
51              
52 3         15 return $self;
53             }
54              
55             =head2 run_parts_command
56              
57             Returns the run-parts to run with the given command parameter
58              
59             =cut
60              
61             sub run_parts_command {
62 19     19 1 36 my $self = shift;
63 19         53 my $rp_cmd = shift;
64              
65 19 100 66     247 my $command =
66             "/bin/run-parts " .
67             ((defined($rp_cmd) and $rp_cmd ne '') ? "'--$rp_cmd'" : '') .
68             " '".$self->{dir}."'";
69              
70 19         364158 return chomped_lines(`$command`);
71             }
72              
73             =head1 SEE ALSO
74              
75             Run::Parts, run-parts(8)
76              
77              
78             =head1 AUTHOR
79              
80             Axel Beckert, C<< >>
81              
82              
83             =head1 BUGS
84              
85             Please report any bugs or feature requests to C
86             rt.cpan.org>, or through the web interface at
87             L. I will
88             be notified, and then you'll automatically be notified of progress on
89             your bug as I make changes.
90              
91              
92             =head1 SUPPORT
93              
94             You can find documentation for this module with the perldoc command.
95              
96             perldoc Run::Parts::Debian
97              
98              
99             =head1 LICENSE AND COPYRIGHT
100              
101             Copyright 2013 Axel Beckert.
102              
103             This program is free software; you can redistribute it and/or modify it
104             under the terms of either: the GNU General Public License as published
105             by the Free Software Foundation; or the Artistic License.
106              
107             See L for more information.
108              
109             =cut
110              
111             1; # End of Run::Parts