BioMart
Root
Toolbar
Summary
Package variables
No package variables defined.
Included modules
Data::Dumper
Log::Log4perl qw ( get_logger :levels )
Inherit
Synopsis
Description
Methods
_equals | No description | Code |
_getParams | No description | Code |
_hashCode | No description | Code |
_init | No description | Code |
_new | No description | Code |
_toString | No description | Code |
addParams | No description | Code |
attr | No description | Code |
checkRequiredParams | No description | Code |
get | No description | Code |
getParam | No description | Code |
loadModule | Description | Code |
set | No description | Code |
setParam | No description | Code |
Methods description
Usage : $self->loadModule($module); my $obj = "$module"->new(@param); Description : Sets up $module (eg BioMart::X::Y::Z) from @INC in the perl symbol table. Caller can then construct an object of type $module. Returntype : none Exceptions : Problems finding module in @INC Caller : caller |
Methods code
sub _equals
{ my $self = shift;
my $object = shift;
return (($object == $self) ||
(ref $object && $object->isa(ref $self) &&
$object->hashCode() eq $self->hashCode())) } |
sub _getParams
{ my $self = shift;
return $self->get('params'); } |
sub _hashCode
{ my $self = shift;
return "$self"; } |
sub _init
{ my ($self, $proto) = @_;
my $paramCopy = {};
my $protoParams = $proto->_getParams;
foreach my $key (keys %{$protoParams}) {
$paramCopy->{$key} = $protoParams->{$key};
}
$self->attr('params', $paramCopy ); } |
sub _new
{ my $self = shift;
$self->attr('params', {});
Log::Log4perl->init(\ qq{
log4perl.logger = FATAL, Screen
log4perl.appender.Screen = Log::Log4perl::Appender::Screen
log4perl.appender.Screen.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.Screen.layout.ConversionPattern = %c:%L:%p> %m%n
log4perl.appender.Screen.stderr = 1
}) unless Log::Log4perl->initialized(); } |
sub _toString
{ my $self = shift;
return Dumper($self);
}
} |
sub addParams
{ my ($self, $titleRef, @param) = @_;
local($^W) = 0; my(%param) = @param;
foreach my $title (@{$titleRef}) {
$self->setParam($title, $param{$title});
} } |
sub attr
{ my $self = shift;
my $attr = shift;
my $value = shift;
if (exists $self->{$attr}) {
BioMart::Exception->throw(sprintf("Attribute '%s' already exists", $attr));
}
$self->{$attr} = $value;
$self->{'_hashDirty'} = 1; } |
sub checkRequiredParams
{ my ($self, $paramref) = @_;
foreach my $reqParam (@{$paramref}) {
unless (defined $self->getParam($reqParam)){
BioMart::Exception->throw("Missing Required Parameter ${reqParam}\n");
}
} } |
sub get
{ my $self = shift;
my $attr = shift;
my $class = ref $self;
if (!exists $self->{$attr}) {
BioMart::Exception->throw(sprintf("Attribute '%s' does not exist", $attr));
}
return $self->{$attr}; } |
sub getParam
{ my ($self, $key) = @_;
return $self->get('params')->{$key}; } |
sub loadModule
{ my ($self, $moduleName) = @_;
eval "require $moduleName" or BioMart::Exception->throw("could not load module $moduleName: $@");
return;
}
1; } |
sub set
{ my $self = shift;
my $attr = shift;
my $value = shift;
if (!exists $self->{$attr}) {
BioMart::Exception->throw(sprintf("Attribute '%s' does not exist", $attr));
}
$self->{$attr} = $value;
$self->{'_hashDirty'} = 1; } |
sub setParam
{ my $self = shift;
my $key = shift;
my $value = shift;
my $params = $self->get('params');
$params->{$key} = $value;
$self->set('params', $params); } |
General documentation
AUTHOR - Arek Kasprzyk, Syed Haider, Damian Smedley | Top |