NAME

BiBiServ::WSCTools - Tools for the http client WebService side of BiBiServ


SYNOPSIS


  my $TOOLNAME="sampleTool";
  my $WSCTools = new BiBiServ::WSCTools(toolname=>$TOOLNAME);
  where $TOOLNAME is the toolname for refering to tool.properties file, which is loaded by BiBiSer::WSCTools.
  (for a introduction and complete documentation see "BiBiServ WebService Developers Guide")


DESCRIPTION

This module provides methods for generating a cgi-based http-interface of a BiBiServ WebService. In combination with BiBiServ::WSCLayout (the corporate identity and layout class of BiBiServ::) you really don't have to do much, if you like the default websites (option: write your own BiBiServ::WSCLayout methods). All work like writing and managing results is done by BiBiServ::WSCTools !

Why should you use this module ?

We (the BiBiServ Administrators) have some rules to follow, so a WebService and the http-Client can work on our System. Using BiBiServ:: is the simpliest way to follow our rules and have a compelte ErrorHandling.


METHODS

new

This is the constructor. Requires the toolname.

  my $WSCTools = new BiBiServ::WSCTools(toolname=>$TOOLNAME);

or a location of a properties file, where the toolname is specified.

  my $WSCTools = new BiBiServ::WSCTools(toolprops=>$FILELOCATION);

Parameters:

When given the toolname, it tries to access the default location of the properties file on

  /vol/<toolname>/etc/tool.properties

So this properties file IS required !

returns contructed object or undef if an error occoured.

The contructor creates the logger, reads the bibi.properties and tool.properties, inits the variables and so on.

Before the logger is created, log messages go to STDERR (so apache error log file) afterwards to the tool log file

makeNiceSeq

tries to parse a given string as sequence in given type.

  my $newSeqString = $WSCTools->makeNiceSeq($type,$string);

Parameters:

$type : Type of sequence

$string : String to parse as sequence

returns string as ``nice'' formated sequence or undef if type unknown or processing was impossible.

Currently known sequence types are:

$type=fasta

seqInfo

a given String as sequence is parsed for information.

  my $statisticSeq = $WSCTools->seqInfo($type,$string);

Parameters:

$type : Type of sequence

$string : String to parse as sequence

returns a hash-ref with information about the sequence. or undef if type unknown or processing was impossible.

Currently known sequence types are:

$type=fasta

  $info{count} = number of sequences
  $info{memcount} = size of all sequences (without description)
  $info{maxsize} = maximum length of all sequences
  $info{minsize} = minimum lenth of all sequences

log

write a log message to project logfile.

 WSCTools->log($level,$msg)

Parameters:

$level : One of Log4perl Levels (debug,info,warn,error,fatal) or mailfatal (which logs to fatal and send a mail to BiBiServ Administrators) (see Log::Log4perl for details)

$msg : message to log.

returns 0 if everything went good and 1 as error.


log a status to project logfile.
 WSCTools->logStatus($level,$status)

Parameters:

$level : One of Log4perl Levels (debug,info,warn,error,fatal) or mailfatal (which logs to fatal and send a mail to BiBiServ Administrators) (see Log::Log4perl for details)

$status : status to log.

returns 0 if everything went good and 1 as error. =cut sub logStatus { my $self = shift; my $level = shift; my $status = shift;

  return $self->log($level,$status->toString());
}

########################################################################## # Spool dir relatied methodes() # =head2 getSpoolDir

  my $spoolDir = $WSCTools->getSpoolDir();

returns String of spoolDir (NOT accessible from outside)

checkemail

checkemail first checks if email has the correct format like a name or two seperated by dots, followed by @ and several names seperated by dots. If this format check is successfull, the method will try to resolve the domain name (the stuff after the @ thing).

  $WSCTools->checkemail("a@b.de")

Parameters:

$mailadr: email adress to check.

returns a empty string if check is successfull, an errormessage otherwise! (for giving back to user)