[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.19, Mon Aug 15 18:49:04 2005 UTC revision 1.23, Tue Sep 13 05:36:12 2005 UTC
# Line 9  Line 9 
9      use CGI;      use CGI;
10      use FIG_Config;      use FIG_Config;
11      use PageBuilder;      use PageBuilder;
12        use Digest::MD5;
13    
14  =head1 Tracing and Debugging Helpers  =head1 Tracing and Debugging Helpers
15    
# Line 895  Line 896 
896  sub UnEscape {  sub UnEscape {
897      # Get the parameter.      # Get the parameter.
898      my ($codedString) = @_;      my ($codedString) = @_;
899        Tracer("Coded string is \"$codedString\".") if T(4);
900      # Initialize the return variable.      # Initialize the return variable.
901      my $retVal = "";      my $retVal = "";
902      # Only proceed if the incoming string is nonempty.      # Only proceed if the incoming string is nonempty.
# Line 1117  Line 1119 
1119    
1120  C<< Confess($message); >>  C<< Confess($message); >>
1121    
1122  Trace the call stack and abort the program with the specified message. The stack  Trace the call stack and abort the program with the specified message. When used with
 trace will only appear if the trace level for this package is 1 or more. When used with  
1123  the OR operator and the L</Assert> method, B<Confess> can function as a debugging assert.  the OR operator and the L</Assert> method, B<Confess> can function as a debugging assert.
1124  So, for example  So, for example
1125    
# Line 1140  Line 1141 
1141      # Get the parameters.      # Get the parameters.
1142      my ($message) = @_;      my ($message) = @_;
1143      # Trace the call stack.      # Trace the call stack.
1144      Cluck($message) if T(1);      Cluck($message);
1145      # Abort the program.      # Abort the program.
1146      croak(">>> $message");      croak(">>> $message");
1147  }  }
# Line 1309  Line 1310 
1310    
1311  C<< if (Tracer::DebugMode) { ...code... } >>  C<< if (Tracer::DebugMode) { ...code... } >>
1312    
1313  Return TRUE if debug mode has been turned on in FIG_Config, else output  Return TRUE if debug mode has been turned on, else output an error
1314  an error page and return FALSE.  page and return FALSE.
1315    
1316  Certain CGI scripts are too dangerous to exist in the production  Certain CGI scripts are too dangerous to exist in the production
1317  environment. This method provides a simple way to prevent them  environment. This method provides a simple way to prevent them
1318  from working unless they are explicitly turned on in the configuration  from working unless they are explicitly turned on by creating a password
1319  file by setting C<$FIG_Config::debug_mode> to 1. If debugging mode  cookie via the B<SetPassword> script.  If debugging mode
1320  is not turned on, an error web page will be output.  is not turned on, an error web page will be output directing the
1321    user to enter in the correct password.
1322    
1323  =cut  =cut
1324    
1325  sub DebugMode {  sub DebugMode {
1326      # Declare the return variable.      # Declare the return variable.
1327      my $retVal;      my $retVal = 0;
1328      # Check the debug configuration.      # Check the debug configuration.
1329      if ($FIG_Config::debug_mode) {      my $password = CGI::cookie("DebugMode");
1330        my $encrypted = Digest::MD5::md5_hex($password);
1331        if ($encrypted eq "252dec43280e0c0d6a75ffcec486e61d") {
1332          $retVal = 1;          $retVal = 1;
1333      } else {      } else {
1334          # Here debug mode is off, so we generate an error page.          # Here debug mode is off, so we generate an error page.
# Line 1391  Line 1395 
1395    
1396  =item padChar (optional)  =item padChar (optional)
1397    
1398    Character to use for padding. The default is a space.
1399    
1400  =item RETURN  =item RETURN
1401    
1402  Returns a copy of the original string with the spaces added to the specified end so  Returns a copy of the original string with the pad character added to the
1403  that it achieves the desired length.  specified end so that it achieves the desired length.
1404    
1405  =back  =back
1406    

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.23

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3