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

Diff of /FigKernelPackages/SAPserver.pm

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

revision 1.1, Tue Jun 16 16:37:23 2009 UTC revision 1.2, Thu Jun 18 01:29:19 2009 UTC
# Line 20  Line 20 
20  package SAPserver;  package SAPserver;
21    
22      use strict;      use strict;
     use Tracer;  
23      use LWP::UserAgent;      use LWP::UserAgent;
24      use YAML;      use YAML;
25    
# Line 32  Line 31 
31  server for extracting data from the Sapling database. Each Sapling server  server for extracting data from the Sapling database. Each Sapling server
32  function correspond to a method of this object.  function correspond to a method of this object.
33    
34    This package deliberately uses no internal SEED packages or scripts, only common
35    PERL modules.
36    
37  The fields in this object are as follows.  The fields in this object are as follows.
38    
39  =over 4  =over 4
# Line 93  Line 95 
95  the constructor) is translated into a request against the server. This  the constructor) is translated into a request against the server. This
96  enables us to add new server functions without requiring an update to this  enables us to add new server functions without requiring an update to this
97  module. The parameters are specified as a hash, and the result is a scalar  module. The parameters are specified as a hash, and the result is a scalar
98  or object reference. If an error occurred, we will confess.  or object reference. If an error occurred, we will throw an exception.
99    
100  =cut  =cut
101    
# Line 118  Line 120 
120      # Get the response content.      # Get the response content.
121      my $content = $response->content;      my $content = $response->content;
122      if (! $response->is_success) {      if (! $response->is_success) {
123          Confess("Server error " . $response->status_line . "\n$content");          die "Server error " . $response->status_line . "\n$content";
124      } else {      } else {
         Trace("YAML document is\n$content.") if T(3);  
125          $retVal = YAML::Load($content);          $retVal = YAML::Load($content);
126          # Figure out what we got back.          # Figure out what we got back.
         Trace("Checking for an error document.") if T(3);  
127          my $returnType = ref $retVal;          my $returnType = ref $retVal;
128          if ($returnType && $returnType eq 'ErrorDocument') {          if ($returnType && $returnType eq 'ErrorDocument') {
129              Confess($retVal->{message});              die $retVal->{message};
130          }          }
131      }      }
132      # Return the result.      # Return the result.

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3