mimecut.pl
changeset 5 c43594b89549
parent 3 2fcd20b32b2e
child 6 b58ecd25d1f1
equal deleted inserted replaced
4:90bce8acdb0b 5:c43594b89549
    67 my $vips;
    67 my $vips;
    68 my $mimes;
    68 my $mimes;
    69 
    69 
    70 my $out_err;
    70 my $out_err;
    71 my $out_std;
    71 my $out_std;
    72 my $out_null;
       
    73 my $logfile;
    72 my $logfile;
    74 my $prefix = '';
    73 my $prefix = '';
    75 
    74 
    76 sub read_conf($);
    75 sub read_conf($);
    77 sub new_parser();
    76 sub new_parser();
   102     if ($opt_pod) {
   101     if ($opt_pod) {
   103         system("pod2usage -v 3 $0") and exit 0;
   102         system("pod2usage -v 3 $0") and exit 0;
   104     }
   103     }
   105 
   104 
   106     $out_std = *STDOUT;
   105     $out_std = *STDOUT;
   107     open($out_null, '>', '/dev/null')
       
   108         or die "$ME can't trash output!\n$!";
       
   109     $out_err = $out_null;
       
   110 
   106 
   111     if ($opt_fake) { $opt_debug = 1 }
   107     if ($opt_fake) { $opt_debug = 1 }
   112     if ($opt_log) {
   108     if ($opt_log) {
   113         die "$ME: can't fake in log mode!\n"
   109         die "$ME: can't fake in log mode!\n"  if $opt_fake;
   114             if ($opt_fake);
   110         die "$ME: can't debug in log mode!\n" if $opt_debug;
   115         die "$ME: can't debug in log mode!\n"
   111         open(STDERR, ">> $LOGDIR/$ME.log")
   116             if ($opt_debug);
       
   117         open($logfile, ">> $LOGDIR/$ME.log")
       
   118             or die "$ME: can't open logfile!\n";
   112             or die "$ME: can't open logfile!\n";
   119         $opt_debug = 1;
   113         $opt_debug = 1;
   120         $out_err   = $logfile;
   114     }
   121     }
   115 	elsif (!$opt_debug) { open(STDERR, ">/dev/null") }
   122     elsif ($opt_debug) { $out_err = *STDERR }
       
   123 
   116 
   124     if ($opt_strain) {
   117     if ($opt_strain) {
   125         if ($opt_fake) {
   118         if ($opt_fake) {
   126             print $out_err "$ME: can't fake in strain mode!\n";
   119             print $out_err "$ME: can't fake in strain mode!\n";
   127             exit 0;
   120             exit 0;