# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Verbosity package for perl. We initialize by setting up: # $P is the program's name, minus any directory. # $V is the verbose level, default = 1. # We also define a number of "print" routines that add assorted stuff # to the output text. ($P = $0) =~ s".*/"" unless defined($P); #$V = $ENV{"V_$P"} || $ENV{"D_$P"} || 3 unless defined($V); #print "$P: V=\"$V\" V=\"$V\".
\n"; #$mimetype = "text/html" unless $mimetype; #$mimehdrs = "Content-type: $mimetype" unless $mimehdrs; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Send a line of HTML text, with a
at the end. #sub hsend { # print "$mimehdrs\n\n" if !$hdrDone++; # print @_, "
\n"; #} # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Send a line of text, with a newline at the end. #sub lsend { # print "$mimehdrs\n\n" if !$hdrDone++; # print @_, "\n"; #} # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Send a string with nothing added.. #sub send { # print "$mimehdrs\n\n" if !$hdrDone++; # print @_; #} # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Set the verbosity from various environment variables. The value may # # be a verbose level (1 digit), plus an optional output file name. # # The file V is opened to the file, if any, or STDERR by default. The # # default value for the verbosity level is 1, which generally means # # to produce only serious error messages. # # # # Here's how this routine is typically called: # # ($P = $0) =~ s'.*/'' unless defined($P); # # &V($ENV{"V_$P"} || $ENV{"D_$P"} || $ENV{"T_$P"} || '1'); # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # sub V { $Vopt = shift; print "
V: Vopt=\"$Vopt\"
\n" if $D>1; if ($Vopt =~ /^(\d+)(.+)$/) { $V = $1; $Vfil = $2; if (!open(V,">>$Vfil")) { print V "$P: Can't write \"$Vfil\" ($!)\n" if $V>0; open(V,">>&STDERR"); } } else { $V = $Vopt; open(V,">>&STDERR"); } select V; $| = 1; select STDOUT; $| = 1; # $esep = '=' x 70; # $hsep = '-' x 70; # print V "\n$P $esep\n" if $V>1; # print V "$P started with V=$V ", `date` if $V>1; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # 1;