moked has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks

I ran this code:
#!/usr/bin/perl -w use strict; use Win32::OLE; use Win32::Process::Info; my $pi = Win32::Process::Info->new (undef, 'WMI'); print "$pi\n\n"; my @info = $pi->GetProcInfo (); # Get the max relationships. for (my $p = 0; $p < scalar @info; $p++) { if (!($info[$p]{'ProcessId'})) { $info[$p]{'ProcessId'} = ''; } if (!($info[$p]{'Name'})) { $info[$p]{'Name'} = ''; } if (!($info[$p]{'ExecutablePath'})) { $info[$p]{'ExecutablePath'} = ''; } my $pid = $info[$p]{'ProcessId'}; my $pnm = $info[$p]{'Name'}; my $pex = $info[$p]{'ExecutablePath'}; print "ID:$pid\tNAME:$pnm\tExPath:$pex\n"; }

and I got the results I wanted.
but before that I got many warnings about LocalTime
which I don't understand.
these are the warnings:

First Warning:
Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time/Local.pm line 76.
Use of uninitialized value in integer multiplication (*) at C:/Perl/lib/Time/Local.pm line 76.
Use of uninitialized value in integer multiplication (*) at C:/Perl/lib/Time/Local.pm line 76.
Use of uninitialized value in pack at C:/Perl/lib/Time/Local.pm line 67.
Use of uninitialized value in pack at C:/Perl/lib/Time/Local.pm line 67.
Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time/Local.pm line 68.
Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time/Local.pm line 69.
Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time/Local.pm line 67.

Repetetive Warning:
Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time/Local.pm line 76.
Use of uninitialized value in integer multiplication (*) at C:/Perl/lib/Time/Local.pm line 76.
Use of uninitialized value in integer multiplication (*) at C:/Perl/lib/Time/Local.pm line 76.
Use of uninitialized value in pack at C:/Perl/lib/Time/Local.pm line 67.
Use of uninitialized value in pack at C:/Perl/lib/Time/Local.pm line 67.
Use of uninitialized value in integer addition (+) at C:/Perl/lib/Time/Local.pm line 67.

The warnings come when this line runs:
my @info = $pi->GetProcInfo ();

I need help overcoming these warnings
Thanks Ahead,
Moked.

Replies are listed 'Best First'.
Re: Warnings in Time/Local (!-w)
by tye (Sage) on Jan 02, 2005 at 08:57 UTC

    Remove the "-w" from the first line and add a "use warnings;" line just below it. It won't work on older versions of Perl, but it has been several years now so it will quite likely work for you.

    Type in the command "perldoc perllexwarn" ("perldoc warnings" would have directed you there) if you'd like to read lots more about this including why what I suggested makes a difference.

    - tye        

      Thanks I worked
      No Warnings now