[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.82, Tue Apr 10 03:51:18 2007 UTC
# Line 2104  Line 2104 
2104  C<< my ($cgi, $varHash) = ScriptSetup($noTrace); >>  C<< my ($cgi, $varHash) = ScriptSetup($noTrace); >>
2105    
2106  Perform standard tracing and debugging setup for scripts. The value returned is  Perform standard tracing and debugging setup for scripts. The value returned is
2107  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,
2108    the client should call L</ScriptFinish> to output the web page.
2109    
2110  The C<Trace> form parameter is used to determine whether or not tracing is active and  This method calls L</ETracing> to configure tracing, which allows the tracing
2111  which trace modules (other than C<Tracer> itself) should be turned on. Specifying  to be configured via the emergency tracing form on the debugging control panel.
 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.  
   
 In some situations, it is not practical to invoke tracing via form parameters. For this  
 situation, you can turn on emergency tracing from the debugging control panel.  
2112  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>
2113  method, which includes every program that uses this method or L</StandardSetup>.  method, which includes every program that uses this method or L</StandardSetup>.
2114    
# Line 2974  Line 2968 
2968      my $line = <$handle>;      my $line = <$handle>;
2969      # Only proceed if we found something.      # Only proceed if we found something.
2970      if (defined $line) {      if (defined $line) {
2971          # Remove the new-line.          # Remove the new-line. We are a bit over-cautious here because the file may be coming in via an
2972          chomp $line;          # upload control and have a nonstandard EOL combination.
2973          Trace("Line read: $line") if T(File => 4);          $line =~ s/(\r|\n)+$//;
2974            # Here we do some fancy tracing to help in debugging complicated EOL marks.
2975            if (T(File => 4)) {
2976                my $escapedLine = $line;
2977                $escapedLine =~ s/\n/\\n/g;
2978                $escapedLine =~ s/\r/\\r/g;
2979                $escapedLine =~ s/\t/\\t/g;
2980                Trace("Line read: -->$escapedLine<--");
2981            }
2982          # If the line is empty, return a single empty string; otherwise, parse          # If the line is empty, return a single empty string; otherwise, parse
2983          # it into fields.          # it into fields.
2984          if ($line eq "") {          if ($line eq "") {
# Line 2994  Line 2996 
2996    
2997  =head3 PutLine  =head3 PutLine
2998    
2999  C<< Tracer::PutLine($handle, \@fields); >>  C<< Tracer::PutLine($handle, \@fields, $eol); >>
3000    
3001  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
3002  output in tab-separated form, with a trailing new-line.  output in tab-separated form, with a trailing new-line.
# Line 3009  Line 3011 
3011    
3012  List of field values.  List of field values.
3013    
3014    =item eol (optional)
3015    
3016    End-of-line character (default is "\n").
3017    
3018  =back  =back
3019    
3020  =cut  =cut
3021    
3022  sub PutLine {  sub PutLine {
3023      # Get the parameters.      # Get the parameters.
3024      my ($handle, $fields) = @_;      my ($handle, $fields, $eol) = @_;
3025      # Write the data.      # Write the data.
3026      print $handle join("\t", @{$fields}) . "\n";      print $handle join("\t", @{$fields}) . ($eol || "\n");
3027  }  }
3028    
3029  =head3 GenerateURL  =head3 GenerateURL

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3