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

How to retrieve right info from list of anonymous hashes

by gepebril69 (Beadle)
on Apr 12, 2012 at 13:33 UTC ( #964755=perlquestion: print w/ replies, xml ) Need Help??
gepebril69 has asked for the wisdom of the Perl Monks concerning the following question:

Hi there,

I want to use Win32::Process::Info to get information if a PID of a process is in use or not, without using the TASKLIST command in Windows which results depends on the language of your OS :S

I've tried the following code, which gave me part of the answer of the puzzle

use Win32::Process::Info; $pi = Win32::Process::Info->new (); $MyPID = $$; @info = $pi->GetProcInfo ($$);
HASH(0x2954c14) which seems to be a list of anonymous hashes The module in CPAN don't give an example of how to do this and Googling for info to retrieve info from such a construction, was not successful. I understand the concept of hashes, but not to this deep level. Can somebody help me out.

Comment on How to retrieve right info from list of anonymous hashes
Download Code
Re: How to retrieve right info from list of anonymous hashes
by moritz (Cardinal) on Apr 12, 2012 at 13:42 UTC
Re: How to retrieve right info from list of anonymous hashes
by JavaFan (Canon) on Apr 12, 2012 at 13:45 UTC
    The module in CPAN don't give an example of how to do this
    Well, it would be too much to expect from every CPAN module that uses hashes to explain to the user to access a hash.

    Try something like:

    foreach my $process (@info) { while (my ($k, $v) = each %$process) { print "$k => $v\n"; } print "\n"; }
    Or use your favourite serializer.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://964755]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-08-23 16:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (174 votes), past polls