jettero / unix--process

Perl extension to get pid info from /bin/ps binary

This URL has Read+Write access

unix--process / Makefile.PL
100644 44 lines (36 sloc) 1.058 kb
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
# vi:set syntax=perl:
 
use ExtUtils::MakeMaker;
 
my $ps = $ENV{PS_PATH} || "/bin/ps";
 
my $worked = 0;
if( -x $ps ) {
    if( open my $in, "$ps -o pid -p $$|" ) {
        while(<$in>) {
            $worked = 1 if m/^\s*$$\s*$/;
        }
        close $in;
    }
}
 
unless( $worked ) {
    warn "this module assumes you have a ps program in /bin/ps\n";
    warn "you can override it by setting an environment variable,\n";
    warn " e.g. PS_PATH=/usr/local/bin/ps; export PS_PATH\n";
    exit 0;
}
 
WriteMakefile(
    NAME => 'Unix::Process',
    AUTHOR => 'Paul Miller <jettero@cpan.org>',
    VERSION_FROM => 'Process.pm',
    PREREQ_PM => {
        'IPC::System::Simple' => 0,
    },
 
    ($ExtUtils::MakeMaker::VERSION ge '6.48'?
        (MIN_PERL_VERSION => 5.008,
            META_MERGE => {
                keywords => [qw(ps process unix)],
                resources=> {
                    repository => 'http://github.com/jettero/unix--process',
                },
            },
 
        LICENSE => 'lgpl',
    ) : ()),
);