[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.50, Wed Apr 28 15:31:12 2010 UTC revision 1.51, Wed Apr 28 15:46:38 2010 UTC
# Line 947  Line 947 
947          # Insure the function name is valid.          # Insure the function name is valid.
948          Die("Invalid function name.")          Die("Invalid function name.")
949              if $function =~ /\W/;              if $function =~ /\W/;
950            # Determing the encoding scheme. The default is YAML.
951            my $encoding = $cgi->param('encoding') || 'yaml';
952          # The parameter structure will go in here.          # The parameter structure will go in here.
953          my $args;          my $args;
954          # Start the timer.          # Start the timer.
# Line 958  Line 960 
960          # Protect from errors.          # Protect from errors.
961          eval {          eval {
962              # Here we parse the arguments. This is affected by the encoding parameter.              # Here we parse the arguments. This is affected by the encoding parameter.
             # The default is YAML.  
             my $encoding = $cgi->param('encoding') || 'yaml';  
963              # Get the argument string.              # Get the argument string.
964              my $argString = $cgi->param('args');              my $argString = $cgi->param('args');
965              if ($encoding eq 'yaml') {              if ($encoding eq 'yaml') {
# Line 985  Line 985 
985                  SendError($@, "Error detected by service.");                  SendError($@, "Error detected by service.");
986                  Trace("Error encountered by service: $@") if T(0);                  Trace("Error encountered by service: $@") if T(0);
987              } else {              } else {
988                  # No error, so we output the result.                  # No error, so we output the result. Start with an HTML header.
989                  print $cgi->header(-type => 'text/plain');                  print $cgi->header(-type => 'text/plain');
990                  my $string = YAML::Dump($document);                  # The nature of the output depends on the encoding type.
991                    my $string;
992                    if ($encoding eq 'yaml') {
993                        $string = YAML::Dump($document);
994                    } else {
995                        $string = JSON::Any->objToJson($document);
996                    }
997                  print $string;                  print $string;
998                  MemTrace(length($string) . " bytes returned from $function by task $$.") if T(Memory => 3);                  MemTrace(length($string) . " bytes returned from $function by task $$.") if T(Memory => 3);
999              }              }

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3