Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Proc::ProcessTable Process name,

by sacked (Hermit)
on Jun 03, 2004 at 14:53 UTC ( [id://360185]=note: print w/replies, xml ) Need Help??


in reply to Proc::ProcessTable Process name,

It's not quite clear what you are asking. Are you looking for the full command line of the process? If so, use the cmndline field of the Proc::ProcessTable::Process that you are examining.

Also, keep in mind that the fields in a Proc::ProcessTable::Process return different values depending on your operating system. From the pod:

See the "README.osname" files in the distribution for more up-to-date information.

If you are seeing a full path and only need the filename (basename) of the process, or if you are seeing the name of the interpreter (e.g., "perl" for a process "perl dodgy.pl"), File::Basename can help:
use strict; use Proc::ProcessTable; use File::Basename; + my $t = Proc::ProcessTable->new; + foreach my $p (@{$t->table}) { print 'process: ', basename($p->cmndline), "\n"; } __END__ for a process `perl /tmp/dodgy.pl', prints `dodgy.pl'

--sacked

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://360185]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-20 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found