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

Diff of /FigKernelPackages/ServerThing.pm

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

revision 1.62, Wed Feb 9 17:56:09 2011 UTC revision 1.65, Mon Mar 14 20:57:19 2011 UTC
# Line 55  Line 55 
55          if ($@) {          if ($@) {
56              SendError($@, "Could not start server.");              SendError($@, "Could not start server.");
57          } else {          } else {
58              # No error, so now we can process the request.              # No error, so now we can process the request. First, get the method list.
59                my $methods = $serverThing->methods();
60                # Store it in the object so we can use it to validate methods.
61                my %methodHash = map { $_ => 1 } @$methods;
62                $serverThing->{methods} = \%methodHash;
63              my $cgi;              my $cgi;
64              if (! defined $key) {              if (! defined $key) {
65                  # No tracing key, so presume we're a web service. Check for Fast CGI.                  # No tracing key, so presume we're a web service. Check for Fast CGI.
# Line 1130  Line 1134 
1134          my $function = $cgi->param('function') || "";          my $function = $cgi->param('function') || "";
1135          Trace("Server function for task $$ is $function.") if T(3);          Trace("Server function for task $$ is $function.") if T(3);
1136          # Insure the function name is valid.          # Insure the function name is valid.
1137          Die("Invalid function name.")          if ($function ne "methods" && exists $serverThing->{methods} && ! $serverThing->{methods}{$function}) {
1138              if $function =~ /\W/;              SendError("Invalid function name.", "$function not found.")
1139            } else {
1140          # Determing the encoding scheme. The default is YAML.          # Determing the encoding scheme. The default is YAML.
1141          my $encoding = $cgi->param('encoding') || 'yaml';          my $encoding = $cgi->param('encoding') || 'yaml';
1142          # Optional callback for json encoded documents          # Optional callback for json encoded documents
# Line 1203  Line 1208 
1208          Trace("Function $function executed in $duration seconds by task $$.") if T(2);          Trace("Function $function executed in $duration seconds by task $$.") if T(2);
1209      }      }
1210  }  }
1211    }
1212    
1213  =head3 CreateFile  =head3 CreateFile
1214    
# Line 1451  Line 1457 
1457  }  }
1458    
1459    
1460    =head3 Log
1461    
1462        Log($msg);
1463    
1464    Write a message to the log. This is a temporary hack until we can figure out how to get
1465    normal tracing and error logging working.
1466    
1467    =over 4
1468    
1469    =item msg
1470    
1471    Message to write. It will be appended to the C<servers.log> file in the FIG temporary directory.
1472    
1473    =back
1474    
1475    =cut
1476    
1477    sub Log {
1478        # Get the parameters.
1479        my ($msg) = @_;
1480        # Open the log file for appending.
1481        if (open(my $oh, ">>$FIG_Config::tmp/servers.log")) {
1482            print $oh "$msg\n";
1483            close $oh;
1484        }
1485    }
1486    
1487  1;  1;

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.65

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3