G
grocery_stocker
In the following perl script snippet, the author has a debug option
sub main() {
my $dir;
error ("LANG is $ENV{LANG} -- UTF is no good, man!")
if ($ENV{LANG} && $ENV{LANG} =~ m/utf/i);
while ($_ = $ARGV[0]) {
shift @ARGV;
if ($_ eq "--verbose") { $verbose++; }
elsif ($_ eq "--debug") { $debug_p++; }
elsif (m/^-v+$/) { $verbose += length($_)-1; }
elsif (m/^-./) { usage; }
elsif (!defined($dir)) { $dir = $_; }
else { usage; }
}
usage unless $dir;
$dir =~ s@/+$@@;
if (! -d $dir) {
print STDERR "$progname: directory $dir does not exist\n";
usage;
}
build_index $dir;
}
main();
exit 0;
What's the point of shoving a debug option into a script that is
supposed to be used by other users?
sub main() {
my $dir;
error ("LANG is $ENV{LANG} -- UTF is no good, man!")
if ($ENV{LANG} && $ENV{LANG} =~ m/utf/i);
while ($_ = $ARGV[0]) {
shift @ARGV;
if ($_ eq "--verbose") { $verbose++; }
elsif ($_ eq "--debug") { $debug_p++; }
elsif (m/^-v+$/) { $verbose += length($_)-1; }
elsif (m/^-./) { usage; }
elsif (!defined($dir)) { $dir = $_; }
else { usage; }
}
usage unless $dir;
$dir =~ s@/+$@@;
if (! -d $dir) {
print STDERR "$progname: directory $dir does not exist\n";
usage;
}
build_index $dir;
}
main();
exit 0;
What's the point of shoving a debug option into a script that is
supposed to be used by other users?