NAME

Bio::Phylo::PhyloWS::Service - Base class for phylogenetic web services

SYNOPSIS

# inside a CGI script:
use CGI;
use Bio::Phylo::PhyloWS::Service::${child};

my $cgi = CGI->new;
my $service = Bio::Phylo::PhyloWS::Service::${child}->new( '-url' => $url );
$service->handle_request($cgi);

DESCRIPTION

This is the base class for services that implement the PhyloWS (http://evoinfo.nescent.org/PhyloWS) recommendations. Such services should subclass this class and implement any relevant abstract methods.

METHODS

REQUEST HANDLER

handle_request()
Type    : Request handler
Title   : handle_request
Usage   : $service->handle_request($cgi);
Function: Handles a service request
Returns : prints out response and exits
Args    : Required: a CGI.pm object

ACCESSORS

get_serialization()

Gets serialization of the provided record

Type    : Accessor
Title   : get_serialization
Usage   : my $serialization = $obj->get_serialization( 
              -guid   => $guid, 
              -format => $format 
          );
Function: Returns a serialization of a PhyloWS database record
Returns : A string
Args    : Required: -guid => $guid, -format => $format
get_record()

Gets a phylows record by its id

Type    : Abstract Accessor
Title   : get_record
Usage   : my $record = $obj->get_record( -guid => $guid );
Function: Gets a phylows record by its id
Returns : Bio::Phylo::Project
Args    : Required: -guid => $guid, 
          Optional: -format => $format
Comments: This is an ABSTRACT method that needs to be implemented
          by a child class
get_query_result()

Gets a phylows cql query result

Type    : Abstract Accessor
Title   : get_query_result
Usage   : my $result = $obj->get_query_result( $query );
Function: Gets a query result 
Returns : Bio::Phylo::Project
Args    : Required: $query
Comments: This is an ABSTRACT method that needs to be implemented
          by a child class
get_supported_formats()

Gets an array ref of supported formats

Type    : Abstract Accessor
Title   : get_supported_formats
Usage   : my @formats = @{ $obj->get_supported_formats };
Function: Gets an array ref of supported formats
Returns : ARRAY
Args    : NONE
Comments: This is an ABSTRACT method that needs to be implemented
          by a child class
get_redirect()

Gets a redirect URL if relevant

Type    : Accessor
Title   : get_redirect
Usage   : my $url = $obj->get_redirect;
Function: Gets a redirect URL if relevant
Returns : String
Args    : $cgi
Comments: This method is called by handle_request so that
          services can 303 redirect a record lookup to 
          another URL. By default, this method returns 
          undef (i.e. no redirect)
get_description()

Gets an RSS1.0/XML representation of a phylows record

Type    : Accessor
Title   : get_description
Usage   : my $desc = $obj->get_description;
Function: Gets an RSS1.0/XML representation of a phylows record
Returns : String
Args    : Required: -guid => $guid
Comments: This method creates a representation of a single record
          (i.e. the service's base url + the record's guid)
          that can be serialized in whichever formats are 
          supported

SEE ALSO

Also see the manual: Bio::Phylo::Manual and http://rutgervos.blogspot.com

REVISION

$Id: Phylo.pm 1045 2009-05-28 22:48:16Z rvos $