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'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.