Proc-PID-File

 view release on metacpan or  search on metacpan

File.pm  view on Meta::CPAN

    if ($^O =~ /linux|freebsd|cygwin|darwin/i) {
        my $me = $self->{verify};
		if (!$me || $me eq "1") {
			$me = $ME;
			if ($^O eq "cygwin") {
				$^X =~ m|([^/]+)$|;
				($me = $1) =~ s/\.exe$//;
				}
			}
		my $cols = delete($ENV{'COLUMNS'}); # prevents `ps` from wrapping
        my @ps = split m|$/|, qx/ps -fp $pid/
            || die "ps utility not available: $!";
        s/^\s+// for @ps;   # leading spaces confuse us

		$ENV{'COLUMNS'} = $cols if defined($cols);
        no warnings;    # hate that deprecated @_ thing
        my $n = split(/\s+/, $ps[0]);
        @ps = split /\s+/, $ps[1], $n;
        $ret = $ps[$n - 1] =~ /\Q$me\E/;;
        }



( run in 0.786 second using v1.01-cache-2.11-cpan-71847e10f99 )