>>>>> "gs" == grocery stocker <cdal
@gmail.com> writes:
gs> In the following perl script snippet, the author has a debug option
forget about the debug option, the code is nutso!
gs> sub main() {
don't use prototypes, especially for no reason.
gs> my $dir;
gs> while ($_ = $ARGV[0]) {
gs> shift @ARGV;
what a wacky way to loop over @ARGV. ever heard of foreach ( @ARGV )??
and his loop fails if ARGV has a '' or 0 value.
gs> if ($_ eq "--verbose") { $verbose++; }
gs> elsif ($_ eq "--debug") { $debug_p++; }
gs> elsif (m/^-v+$/) { $verbose += length($_)-1; }
gs> elsif (m/^-./) { usage; }
gs> elsif (!defined($dir)) { $dir = $_; }
gs> else { usage; }
ewww. not much more i can say about that.
gs> What's the point of shoving a debug option into a script that is
gs> supposed to be used by other users?
it would be harder to maintain 2 versions of the code, with/without
debugging options. if the real debug code isn't in the way or slows down
the program, this little debug option is not a problem.
uri
--
Uri Guttman ------ u@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org