Clair::Bio

EUtils


SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods

SummaryTop
Clair::Bio::EUtils - a base class for Bio::EUtils objects

Package variablesTop
No package variables defined.

Included modulesTop
Exporter
URI::Escape

InheritTop
Exporter

SynopsisTop
    use Clair::Bio::EUtils qw($ESEARCH_URL);
print "$ESEARCH_URL\n";

DescriptionTop
This module is a container for variables useful inside of Clair::Bio::EUtils::*.

MethodsTop
build_urlDescriptionCode
hash2argsDescriptionCode

Methods description


build_urlcode    nextTop
    my %args = ( this => "that thing" );
my $base = "http://foo.bar/thing.cgi";
my $url = build_url( base => $base, args => \%ags );
print "$url\n"; $ prints http://foo.bar/thing.cgi?this=that%20thing

hash2argscodeprevnextTop
    my %hash = ( this => "that thing", foo => "bar" );
my $str = hash2args(%hash);
print "$str\n"; # prints this=that%20thing&foo=bar

Methods code


build_urldescriptionprevnextTop
sub build_url {
    my %params = @_;
    my $base = $params{base} || "";
    my $argsref = $params{args} || {};
    unless ($base =~ /\?$/) {
        $base .= "?";
    }
    return $base . hash2args(%$argsref);
}

hash2argsdescriptionprevnextTop
sub hash2args {
    my %args = @_;
    map { delete $args{$_} unless $args{$_} } keys %args;
    return join("&", 
        ( map { uri_escape($_)."=".uri_escape($args{$_}) } sort keys %args ));
}

General documentation


EXPORTABLE METHODSTop

EXPORTABLE VARIABLESTop
$ROOT_URL - the base url that all eutils depend upon
$ESEARCH_URL - the esearch url, including the ? at the end
$TOOL - the name of the tool to send to EUtils
$EMAIL - the email address to send to EUtils

AUTHORTop
Tony Fader, afader@umich.edu