A generic CGI client class for Bio::PSORT::* classes. The class provides an interface for CGI argument processing and output report parsing.
class NewClient < CGIDriver def initialize(host, path) super(host, path) end end private def make_args(query) # ... end def parse_report(output) # ... end
Sets remote host name and cgi path or uri.
CGIDriver.new("localhost", "/cgi-bin/psort_www.pl") CGIDriver.new("http://localhost/cgi-bin/psort_www.pl") CGIDriver.new(URI.parse("http://localhost/cgi-bin/psort_www.pl"))
# File lib/bio/appl/psort.rb, line 94 def initialize(host = '', path = '') case host.to_s when /^http:/ uri = host.to_s else uri = 'http://' + host + '/' + path end @uri = URI.parse(uri) @args = {} @report = '' end
Executes a CGI "query" and returns aReport
# File lib/bio/appl/psort.rb, line 108 def exec(query) data = make_args(query) begin result = nil Bio::Command.start_http(@uri.host) {|http| result = http.post(@uri.path, data) } @report = result.body output = parse_report(@report) end return output end
Generated with the Darkfish Rdoc Generator 2.