Hi Gregor and hi Wolfgang On Fri, Dec 16, 2011 at 10:14:14PM +0100, gregor herrmann wrote: > On Fri, 16 Dec 2011 21:05:59 +0000, Wolfgang Wilhelm wrote: > > > > $p->{pid} and $p->{cmndline} is probably cleaner. > > Agreed. Is it cleaner in the perldoc part, too?
But I think this in the documentation because of this: The elements of @{ $p->table } are Proc::ProcessTable *objects*, the documentation to the table methods states: table Reads the process table and returns a reference to an array of Proc::ProcessTable::Process objects. Attributes of a process object are returned by accessors named for the attribute; for example, to get the uid of a process just do: $process->uid The priority and pgrp methods also allow values to be set, since these are supported directly by internal perl functions. You see that e.g. by dumping with Data::Dumper: ---[ example ]--------------------------------------------------------- #!/usr/bin/perl use strict; use warnings; use Proc::ProcessTable; use Data::Dumper; my $p = Proc::ProcessTable->new(); foreach $ref ( @{ $p->table } ) { print Dumper($ref); } ----------------------------------------------------------------------- Now the $ref's are process objects, hashrefs blessed into Proc::ProcessTable objects. I think thus the notation in documentation of Proc::ProcessTable makes sense this way. Well okay you *can* access the keys of $ref via $ref->{uid}, as this is a hashreference, blessed into Proc::ProcessTable. Do you agree? Regards Salvatore
signature.asc
Description: Digital signature