in reply to MoveCeiling - monitor filesystem growth

You should include the warnings and strict pragmas in your code to help you locate mistakes. After I corrected the error on line 159 I compiled with warnings enabled which produced these messages:
Unquoted string "true" may clash with future reserved word at 555648.p +l line 98. Bareword found in conditional at 555648.pl line 146. main::showUsage() called too early to check prototype at 555648.pl lin +e 27. main::spinUpRoutine() called too early to check prototype at 555648.pl + line 32. main::mainRoutine() called too early to check prototype at 555648.pl l +ine 33. main::spinDownRoutine() called too early to check prototype at 555648. +pl line 34. Name "main::targetVGSpaceRemaiing" used only once: possible typo at 55 +5648.pl line 127.
if ($#ARGV!=6)
Your program requires seven arguments so why are you obfuscating that fact?
if ( @ARGV != 7 )
All of your subroutines except spinDownRoutine() are only called once. Subroutines are very handy if you have to encapsulate data and code that has to be used multiple times however you are neither encapsulating the data in the subroutine nor using them more than once so why put everything in subroutines?

Replies are listed 'Best First'.
Re^2: MoveCeiling - monitor filesystem growth
by bpoag (Monk) on Jun 16, 2006 at 18:10 UTC
    Hey!

    With regard to $#ARGV versus @ARGV... I was working with indexes at that point in the code, and didn't think to switch gears mentally and make the check look more readable. You are correct, it is a little obfuscated to an outside observer, since element 0 is the beginning of the argument list in ARGV versus 1 with 0 being the command itself. Thats what $0 is for, as you probably know. Good catch, btw.

    Blocking things off into subroutines right off the bat is sort of a style quirk of mine. For strict procedural things, you're right, it's sort of pointless...But it helps if I have to revisit the code later and make changes, which is a frequent occurence here where I work. It's kind of funny, we have sort of a generic "grandfather" script we use over here as sort of a template for "watch this, do this, and notify this person" tasks...This script wasn't derived from it, specifically, but I can think of at least half a dozen scripts we use that were, and it came in handy to have things already compartmentalized like that. spinDownRoutine() is a good example. Everything I write has a spinUp/Down routine. Sometimes they come in handy, other times they're just withered limbs.

    As for the typo, that's an artifact of the cut/paste process to get it posted here on PerlMonks. :)

    Cheers,
    Bowie