[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.59, Tue Jan 11 15:03:02 2011 UTC revision 1.60, Tue Jan 25 22:44:43 2011 UTC
# Line 40  Line 40 
40      # Create the server object.      # Create the server object.
41      Trace("Requiring $serverName for task $$.") if T(3);      Trace("Requiring $serverName for task $$.") if T(3);
42      eval {      eval {
43            my $output = $serverName;
44            $output =~ s/::/\//;
45          require "$serverName.pm";          require "$serverName.pm";
46      };      };
47      # If we have an error, create an error document.      # If we have an error, create an error document.
# Line 1126  Line 1128 
1128              if $function =~ /\W/;              if $function =~ /\W/;
1129          # Determing the encoding scheme. The default is YAML.          # Determing the encoding scheme. The default is YAML.
1130          my $encoding = $cgi->param('encoding') || 'yaml';          my $encoding = $cgi->param('encoding') || 'yaml';
1131            # Optional callback for json encoded documents
1132            my $callback = $cgi->param('callback');
1133          # The parameter structure will go in here.          # The parameter structure will go in here.
1134          my $args = {};          my $args = {};
1135          # Start the timer.          # Start the timer.
# Line 1170  Line 1174 
1174                  Trace("Error encountered by service: $@") if T(0);                  Trace("Error encountered by service: $@") if T(0);
1175              } else {              } else {
1176                  # No error, so we output the result. Start with an HTML header.                  # No error, so we output the result. Start with an HTML header.
1177                    if ($encoding eq 'yaml') {
1178                  print $cgi->header(-type => 'text/plain');                  print $cgi->header(-type => 'text/plain');
1179                    } else {
1180                        print $cgi->header(-type => 'text/javascript');
1181                    }
1182                  # The nature of the output depends on the encoding type.                  # The nature of the output depends on the encoding type.
1183                  my $string;                  my $string;
1184                  if ($encoding eq 'yaml') {                  if ($encoding eq 'yaml') {
1185                      $string = YAML::Dump($document);                      $string = YAML::Dump($document);
1186                    } elsif(defined($callback)) {
1187                        $string = $callback . "(".JSON::Any->objToJson($document).")";
1188                  } else {                  } else {
1189                      $string = JSON::Any->objToJson($document);                      $string = JSON::Any->objToJson($document);
1190                  }                  }

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3