in reply to How to GET CPU values from WMI

Where does $key get its value from?

$hash->{$v->{$key}}->{$_} = $v->{$_} for @properties; ##............^^^^

If you used strict & warnings, you'd probably have solved this yourself.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: How to GET CPU values from WMI
by gulden (Monk) on Jan 20, 2011 at 16:39 UTC
    Here is the key value:
    my $key = 'Name';
    As far as I know i need to instantiate the Performance Counter before I use it, like:
    # pseudo algorithm my $inst = new PerformanceCounter('CPU'); while(true){ $sample = $inst->get_next_sample(); print $sample->{'total'}; print $sample->{'idle'}; print $sample->{'system'}; print $sample->{'user'}; }

    But i don't know how to do it using WMI. I think I'm forced to use other method, that doesn't use WMI. Any tips?

    Tks

    MG

      It's still not clear to me from this thread nor your previous what you are actually trying to achieve, but you might take a look at DBD::WMI.