in reply to Win32::PerfMon get no instances or objects name

Update : please excuse my following rant, it concerns Win32::PerfLib, while shonorio is really asking about Win32::PerfMon , a module that I didn't know but actually exists.
It's still possible to access counters with Win32::PerfLib , but PerfMon looks much simpler .

----------

Hello,

The win32 perflib data structure is very close to hell !

If your are using Win32::PerfLib ( and not PerfMon as you say) the return value of the method you use has no sense other than failure (0) or success (anything but 0).
The interesting results are obtained in a hash that you pass as a reference in the call to the method.
Look at the docs :

$ok = Win32::PerfLib::GetCounterNames($server,$hashref)
Then you have a reference to an hash in $hashref .
The meanings of the keys of this hash are described in the docs.
It gets nasty because most of these keys point to other hashes that in turn point to hashes .
There is seven levels of such hashes in this so-called "structure" ...
... Don't use it if you don't have to ;)

Hope this helps,
zlr .

Replies are listed 'Best First'.
Re^2: Win32::PerfMon get no instances or objects name
by shonorio (Hermit) on Mar 15, 2005 at 17:01 UTC
    ZIR

    You are double right, right because I can get this information by Win32::PerLib and it is not easy, but I have one script to do this.

    And second right because Win32::PerfMon is to much easy and simple, that why I'm trying to solve this little problem.

    Thanks for your post

    Solli Moreira Honorio
    Sao Paulo - Brazil
      Hello shonorio,

      Did you find a solution for this yet ?
      I finally got to install Win32::PerfMon. (i used the ppm version available at bribes.org/perl/ppm )
      My finds are : it works if you don't use strict .
      For the record the exact error message with this is :

      Can't use string ("-1") as an ARRAY ref while "strict refs" in use
      The other interesting find is that i can't get any "Instances" values to print, only "Counters" . This sounds really like some "PerfLib hell" to me. The way i understand it, an object can have either counters or instances which in turn can have either one and so on .

      Maybe the module is not fully functional ?
      Can anyone shed more light on this since Win32::Perfmon looks promising but not fully working ?! .