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'