howto list running processes with Perl?

howto list running processes with Perl?

am 19.04.2005 18:17:52 von clint

please help.
i need to list running processes with Perl, any suggestions?
many thanx
clint

Re: howto list running processes with Perl?

am 19.04.2005 18:20:01 von clint

On Tue, 19 Apr 2005 16:17:52 +0000, clint wrote:

> please help.
> i need to list running processes with Perl, any suggestions?
> many thanx
> clint

sorry i mean howto count them!
thanx
clint

Re: howto list running processes with Perl?

am 20.04.2005 01:24:51 von Rene Schickbauer

clint wrote:

> On Tue, 19 Apr 2005 16:17:52 +0000, clint wrote:
>
>> please help.
>> i need to list running processes with Perl, any suggestions?
>> many thanx
>> clint
>
> sorry i mean howto count them!
> thanx
> clint

A rude approach would be to use backticks:

my @proc = `ps -ax`;
my $cnt = $#proc;
print "Running processes: $cnt\n";

But while where already spawning a process, why not spawn 2 and save a line
of code:

my $cnt = `ps -ax | wc -l` + 0;
print "Running processes: $cnt\n";

LLAP & LG
Rene

Re: howto list running processes with Perl?

am 20.04.2005 14:54:22 von George Bouras

For windows you can use the Win32_Process of wmi , or for faster execution
use the Win::API module to call the psapi.dll

Re: howto list running processes with Perl?

am 21.04.2005 23:29:11 von Eric Teuber

Rene Schickbauer wrote:
> clint wrote:
>
>
>>On Tue, 19 Apr 2005 16:17:52 +0000, clint wrote:
>>
>>
>>>please help.
>>>i need to list running processes with Perl, any suggestions?
>>>many thanx
>>>clint
>>
>>sorry i mean howto count them!
>>thanx
>>clint
>
>
> A rude approach would be to use backticks:
>
> my @proc = `ps -ax`;
> my $cnt = $#proc;
> print "Running processes: $cnt\n";
>
> But while where already spawning a process, why not spawn 2 and save a line
> of code:
>
> my $cnt = `ps -ax | wc -l` + 0;
> print "Running processes: $cnt\n";
>
> LLAP & LG
> Rene

why not just

print `ps -ef | wc -l`;

Eric

Re: howto list running processes with Perl?

am 05.05.2005 12:00:36 von Tim X

clint writes:

> please help.
> i need to list running processes with Perl, any suggestions?
> many thanx
> clint

On what platform - windows, mac, linux?

Tim
--
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you
really need to send mail, you should be able to work it out!