Commit 0a2faf3e authored by Jessica Severin's avatar Jessica Severin
Browse files

added method Bio::EnsEMBL::Pipeline::RunnableDB::encode_hash

which takes a hash ref as a parameter and returns a string which can
be evaled back to the hash.  $hash_ref = eval(encode_hash($hash_ref));
parent e6808022
......@@ -177,5 +177,22 @@ sub Bio::EnsEMBL::Pipeline::RunnableDB::branch_code
return $self->{'_branch_code'};
}
sub Bio::EnsEMBL::Pipeline::RunnableDB::encode_hash
{
my $self = shift;
my $hash_ref = shift;
return "" unless($hash_ref);
my $hash_string = "{";
my @keys = keys %{$hash_ref};
foreach my $key (@keys) {
$hash_string .= "'$key'=>'" . $hash_ref->{$key} . "',";
}
$hash_string .= "}";
return $hash_string;
}
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment