Bio-Das-ProServer

 view release on metacpan or  search on metacpan

lib/Bio/Das/ProServer.pm  view on Meta::CPAN

#########
# ProServer DAS Server
# Author:        rmp
# Maintainer:    $Author: zerojinx $
# Created:       2003-05-22
# Last Modified: $Date: 2010-11-02 11:37:11 +0000 (Tue, 02 Nov 2010) $
# Source:        $Source $
# Id:            $Id $
#
## no critic (ValuesAndExpressions::ProhibitMagicNumbers)
## no critic (Variables::RequireLocalizedPunctuationVars)
## no critic (ControlStructures::ProhibitCascadingIfElse)
#
package Bio::Das::ProServer;
use warnings;
use strict;
use Bio::Das::ProServer::Config;
use CGI qw(:cgi);
use HTTP::Request;
use HTTP::Response;
use Compress::Zlib;
use Getopt::Long;
use POE;                         # Base features.
use POE::Filter::HTTPD;          # For serving HTTP content.
use POE::Wheel::ReadWrite;       # For socket I/O.
use POE::Wheel::SocketFactory;   # For serving socket connections.
use POSIX qw(setsid strftime);
use File::Spec;
use Sys::Hostname;
use Bio::Das::ProServer::SourceAdaptor;
use Bio::Das::ProServer::SourceHydra;
use Socket;
use English qw(-no_match_vars);
use Carp;
use Readonly;

our $DEBUG          = 0;
our $VERSION        = do { my ($v) = (q$Revision: 687 $ =~ /\d+/mxsg); $v; };
Readonly::Scalar our $GZIP_THRESHOLD => 10_000;
$ENV{'PATH'}        = '/bin:/usr/bin:/usr/local/bin';
our $COORDINATES    = undef;
Readonly::Scalar our $WRAPPERS => {
  # Note that the xml-stylesheet processing instructions below use the 'text/xsl' media type, this is technically incorrect as it is not a registered type, really it should be 'application/xslt+xml' but text/xsl is universally supported by browsers
  'sources'      => {
                     'open'  => qq(<?xml version="1.0" standalone="no"?>\n<?xml-stylesheet type="text/xsl" href="sources.xsl"?>\n<SOURCES>\n),
                     'close' => qq(</SOURCES>\n),
                    },
  'dsn'          => {
                     'open'  => qq(<?xml version="1.0" standalone="no"?>\n<?xml-stylesheet type="text/xsl" href="dsn.xsl"?>\n<!DOCTYPE DASDSN SYSTEM 'http://www.biodas.org/dtd/dasdsn.dtd' >\n<DASDSN>\n),
                     'close' => qq(</DASDSN>\n),
                    },
  'features'     => {
                     'open'  => qq(<?xml version="1.0" standalone="yes"?>\n<?xml-stylesheet type="text/xsl" href="features.xsl"?>\n<!DOCTYPE DASGFF SYSTEM "http://www.biodas.org/dtd/dasgff.dtd">\n<DASGFF>\n  <GFF href="%sourceurl/features">\n),
                     'close' => qq(  </GFF>\n</DASGFF>\n),
                    },
  'dna'          => {
                     'open'  => qq(<?xml version="1.0" standalone="no"?>\n<?xml-stylesheet type="text/xsl" href="sequence.xsl"?>\n<!DOCTYPE DASDNA SYSTEM "http://www.biodas.org/dtd/dasdna.dtd">\n<DASDNA>\n),
                     'close' => qq(</DASDNA>\n),
                    },
  'sequence'     => {
                     'open'  => qq(<?xml version="1.0" standalone="no"?>\n<?xml-stylesheet type="text/xsl" href="sequence.xsl"?>\n<!DOCTYPE DASSEQUENCE SYSTEM "http://www.biodas.org/dtd/dassequence.dtd">\n<DASSEQUENCE>\n),
                     'close'  => qq(</DASSEQUENCE>\n),
                    },
  'types'        => {
                     'open'  => qq(<?xml version="1.0" standalone="no"?>\n<?xml-stylesheet type="text/xsl" href="types.xsl"?>\n<!DOCTYPE DASTYPES SYSTEM "http://www.biodas.org/dtd/dastypes.dtd">\n<DASTYPES>\n  <GFF version="1.0" href="%sourceurl/type...
                     'close'  => qq(  </GFF>\n</DASTYPES>\n),
                    },
  'entry_points' => {
                     'open'  => qq(<?xml version="1.0" standalone="no"?>\n<!DOCTYPE DASEP SYSTEM "http://www.biodas.org/dtd/dasep.dtd">\n<DASEP>\n  <ENTRY_POINTS href="%sourceurl/entry_points" version="1.0">\n),
                     'close'  => qq(  </ENTRY_POINTS>\n</DASEP>\n),
                    },
  'alignment'    => {
                     'open'  => qq(<?xml version="1.0" standalone="no"?>\n<dasalignment xmlns="http://www.efamily.org.uk/xml/das/2004/06/17/dasalignment.xsd" xmlns:align="http://www.efamily.org.uk/xml/das/2004/06/17/alignment.xsd" xmlns:xsd="http://w...
                     'close'  => qq(</dasalignment>\n),
                    },
  'structure'    => {
                     'open'  => qq(<?xml version="1.0" standalone="no"?>\n<dasstructure xmlns="http://www.efamily.org.uk/xml/das/2004/06/17/dasstructure.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:schemaLocation="http://www.efamily...
                     'close'  => qq(</dasstructure>\n),
                    },

lib/Bio/Das/ProServer.pm  view on Meta::CPAN

=head1 CONFIGURATION AND ENVIRONMENT

  See eg/proserver.ini

=head1 SUBROUTINES/METHODS

=head2 run

=head2 DEBUG

=head2 server_spawn

=head2 server_start

=head2 server_stop

=head2 server_got_error

=head2 server_do_fork

=head2 server_got_sig_hup

=head2 server_got_sig_int

=head2 server_got_sig_chld

=head2 server_got_connection

=head2 client_start

=head2 client_stop

=head2 client_got_request

=head2 response_xsl

=head2 response_general

=head2 response_dsn

=head2 response_sources

=head2 response_homepage

=head2 build_das_response

=head2 client_got_error

=head2 client_flushed_request

=head2 make_pidfile

=head2 remove_pidfile

=head2 log

=head1 DEPENDENCIES

Bio::Das::ProServer::Config
CGI :cgi
HTTP::Request
HTTP::Response
Compress::Zlib
Getopt::Long
POE
POE::Filter::HTTPD
POE::Wheel::ReadWrite
POE::Wheel::SocketFactory
POSIX setsid strftime
File::Spec
Sys::Hostname
Bio::Das::ProServer::SourceAdaptor
Bio::Das::ProServer::SourceHydra
Socket
English
Carp

=head1 INCOMPATIBILITIES

=head1 BUGS AND LIMITATIONS

=head1 AUTHOR

$Author: Roger Pettett$

=head1 LICENSE AND COPYRIGHT

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

=cut



( run in 0.532 second using v1.01-cache-2.11-cpan-f4a522933cf )