[Bio] / FigKernelPackages / Tracer.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Tracer.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.79, Thu Nov 9 21:12:46 2006 UTC revision 1.83, Fri Apr 27 22:13:57 2007 UTC
# Line 662  Line 662 
662          }          }
663          exit(0);          exit(0);
664      }      }
665        # Trace the options, if applicable.
666        if (T(3)) {
667            my @parms = grep { $retOptions->{$_} } keys %{$retOptions};
668            Trace("Selected options: " . join(", ", sort @parms) . ".");
669        }
670      # Return the parsed parameters.      # Return the parsed parameters.
671      return ($retOptions, @retParameters);      return ($retOptions, @retParameters);
672  }  }
# Line 2104  Line 2109 
2109  C<< my ($cgi, $varHash) = ScriptSetup($noTrace); >>  C<< my ($cgi, $varHash) = ScriptSetup($noTrace); >>
2110    
2111  Perform standard tracing and debugging setup for scripts. The value returned is  Perform standard tracing and debugging setup for scripts. The value returned is
2112  the CGI object followed by a pre-built variable hash.  the CGI object followed by a pre-built variable hash. At the end of the script,
2113    the client should call L</ScriptFinish> to output the web page.
 The C<Trace> form parameter is used to determine whether or not tracing is active and  
 which trace modules (other than C<Tracer> itself) should be turned on. Specifying  
 the C<CGI> trace module will trace parameter and environment information. Parameters are  
 traced at level 3 and environment variables at level 4. To trace to a file instead of to  
 the web page, set C<TF> to 1. At the end of the script, the client should call  
 L</ScriptFinish> to output the web page.  
2114    
2115  In some situations, it is not practical to invoke tracing via form parameters. For this  This method calls L</ETracing> to configure tracing, which allows the tracing
2116  situation, you can turn on emergency tracing from the debugging control panel.  to be configured via the emergency tracing form on the debugging control panel.
2117  Tracing will then be turned on automatically for all programs that use the L</ETracing>  Tracing will then be turned on automatically for all programs that use the L</ETracing>
2118  method, which includes every program that uses this method or L</StandardSetup>.  method, which includes every program that uses this method or L</StandardSetup>.
2119    
# Line 2974  Line 2973 
2973      my $line = <$handle>;      my $line = <$handle>;
2974      # Only proceed if we found something.      # Only proceed if we found something.
2975      if (defined $line) {      if (defined $line) {
2976          # Remove the new-line.          # Remove the new-line. We are a bit over-cautious here because the file may be coming in via an
2977          chomp $line;          # upload control and have a nonstandard EOL combination.
2978          Trace("Line read: $line") if T(File => 4);          $line =~ s/(\r|\n)+$//;
2979            # Here we do some fancy tracing to help in debugging complicated EOL marks.
2980            if (T(File => 4)) {
2981                my $escapedLine = $line;
2982                $escapedLine =~ s/\n/\\n/g;
2983                $escapedLine =~ s/\r/\\r/g;
2984                $escapedLine =~ s/\t/\\t/g;
2985                Trace("Line read: -->$escapedLine<--");
2986            }
2987          # If the line is empty, return a single empty string; otherwise, parse          # If the line is empty, return a single empty string; otherwise, parse
2988          # it into fields.          # it into fields.
2989          if ($line eq "") {          if ($line eq "") {
# Line 2994  Line 3001 
3001    
3002  =head3 PutLine  =head3 PutLine
3003    
3004  C<< Tracer::PutLine($handle, \@fields); >>  C<< Tracer::PutLine($handle, \@fields, $eol); >>
3005    
3006  Write a line of data to a tab-delimited file. The specified field values will be  Write a line of data to a tab-delimited file. The specified field values will be
3007  output in tab-separated form, with a trailing new-line.  output in tab-separated form, with a trailing new-line.
# Line 3009  Line 3016 
3016    
3017  List of field values.  List of field values.
3018    
3019    =item eol (optional)
3020    
3021    End-of-line character (default is "\n").
3022    
3023  =back  =back
3024    
3025  =cut  =cut
3026    
3027  sub PutLine {  sub PutLine {
3028      # Get the parameters.      # Get the parameters.
3029      my ($handle, $fields) = @_;      my ($handle, $fields, $eol) = @_;
3030      # Write the data.      # Write the data.
3031      print $handle join("\t", @{$fields}) . "\n";      print $handle join("\t", @{$fields}) . ($eol || "\n");
3032  }  }
3033    
3034  =head3 GenerateURL  =head3 GenerateURL

Legend:
Removed from v.1.79  
changed lines
  Added in v.1.83

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3