Re: Question on loops and return values

From: Jim Keenan (jkeen_via_google_at_yahoo.com)
Date: 12/04/04


Date: Fri, 03 Dec 2004 23:44:56 GMT

delfuego wrote:

> I have a script below that is supposed to read in a list of microsoft
> servers, and output the disk space (current and last), dates
> (beginning and ending), and compute space growth in value and
> percentage; to output file. The question is this: how do I get the
> correct looping going on in my for loops (one is not getting the
> machines, the other is not getting the drive letters; as well as any
> other problems you can point out. The files are listed below the
> scriipt, although I plan to write out two additional columns, growth
> value and growth rate.
> ALL help is appreciated.
> Thanks,
>
> James

Am I correct in suspecting that this is a script that someone else
originally wrote and you have to fix? There's a lot of
less-than-optimal code below (e.g., use of 'our' where 'my' would almost
certainly suffice).

>
> <script beow inline>
>
> use lib "$ENV(HOME)/site/lib"; # occasionally perl whines about not
> in a lib
> no lib ".";
> use warnings;
> use Time::localtime; # needed for tm and using that to get dates
> use Time::tm;
> use Win32API::Resources; # needed for drives and disk space
>
> our @drive = Win32API::Resources::GetDrives();
> our %space = Win32API::Resources::GetDriveSpace("$let:\\");

Here a USENETtiquette problem arises. In order for us to troubleshoot
your code, we need to be on Windows, because the Win32API modules only
work on that OS. If your problem is a Windows-specific problem, then
you should probably post it on a Windows-specific list such as
perl-win32-users@activestate.com. But I'm not reading this on Windows,
so I can't test your code. My hunch is that your problem is *not*
Windows-specific, but is located in how to read directory and file
information.

Wherever you post, you should try to post the smallest possible amount
of code needed to illustrate the problem. Most of the people who read
this list don't have enough time to work through all of it --
particularly if it requires a particular OS. If you try to post the
smallest possible amount you will, in the process, probably locate your
error yourself.

> our $file = (<SD>,"growth.cvs"); # output data file
> our $file2 = (<SD>,"machines.cvs"); # input data file
> our $let = ['A-Z']; # character value for drive letters

[snip balance]

Jim Keenan



Relevant Pages

  • Re: 16 Bit Error
    ... Setup Factory is a trademark of Indigo Rose Corporation. ... MS-MVP Windows Shell/User ... sure that the directory path exists, and disk space is available. ... problem and they are trying to install a 16-bit program on purpose.... ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: 16 Bit Error
    ... and disk space is available. ... The 16 Bit MS-DOS Subsystem error may also show the program. ... Take Ownership of a File or Folder in Windows XP ... problem and they are trying to install a 16-bit program on purpose.... ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: 16 Bit Error
    ... I do have the pss folder and replaced both .ini files, ... meant for earlier versions of Windows. ... sure that the directory path exists, and disk space is available. ... other programs I have tried to install give me the same error. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: 16 Bit Error
    ... of windows, used my WinXP Pro disc and did a repair. ... install, and it still did not work. ... Setup Factory is a trademark of Indigo Rose Corporation. ... sure that the directory path exists, and disk space is available. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: 16 Bit Error
    ... meant for earlier versions of Windows. ... which is 16 Bit MS-DOS Subsystem. ... sure that the directory path exists, and disk space is available. ... problem and they are trying to install a 16-bit program on purpose.... ...
    (microsoft.public.windowsxp.help_and_support)