Skip to content
Snippets Groups Projects
Commit c8354fe8 authored by Leo Gordon's avatar Leo Gordon
Browse files

destringificaton utility method added

parent 5b7bf3f3
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ This module implements the following capabilities:
package Bio::EnsEMBL::Hive::ProcessWithParams;
use strict;
use Bio::EnsEMBL::Hive::Utils 'destringify'; # import 'destringify()'
use base ('Bio::EnsEMBL::Hive::Process');
sub strict_hash_format { # This public virtual must be redefined to "return 0;" in all inheriting classes
......@@ -109,14 +110,8 @@ sub _parse_meta {
my $sth = $self->db->dbc()->prepare("SELECT meta_key, meta_value FROM meta ORDER BY meta_id");
$sth->execute();
while (my ($meta_key, $meta_value)=$sth->fetchrow_array()) {
if($meta_value=~/^'.*'$/
or $meta_value=~/^".*"$/
or $meta_value=~/^{.*}$/
or $meta_value=~/^[.*]$/) {
$meta_value = eval($meta_value);
}
$meta_params_hash{$meta_key} = $meta_value;
$meta_params_hash{$meta_key} = destringify($meta_value);
}
$sth->finish();
......
......@@ -45,7 +45,7 @@ use warnings;
use Data::Dumper;
use Exporter 'import';
our @EXPORT_OK = qw( stringify );
our @EXPORT_OK = qw( stringify destringify );
sub stringify {
my $structure = pop @_;
......@@ -59,5 +59,21 @@ sub stringify {
return Dumper($structure);
}
sub destringify { # eval if it seems to be a perl hash/array/string and leave intact otherwise
my $value = pop @_;
if($value) {
if($value=~/^'.*'$/
or $value=~/^".*"$/
or $value=~/^{.*}$/
or $value=~/^[.*]$/) {
$value = eval($value);
}
}
return $value;
}
1;
......@@ -5,6 +5,7 @@ use warnings;
use DBI;
use Getopt::Long;
use Bio::EnsEMBL::Hive::Utils 'destringify';
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::Worker;
use Bio::EnsEMBL::Hive::Queen;
......@@ -146,7 +147,10 @@ sub main {
$queen->{'maximise_concurrency'} = 1 if ($self->{'maximise_concurrency'});
$queen->{'verbose_stats'} = $self->{'verbose_stats'};
my $pipeline_name = $self->{'dba'}->get_MetaContainer->list_value_by_key("name")->[0];
my $pipeline_name = destringify(
$self->{'dba'}->get_MetaContainer->list_value_by_key("pipeline_name")->[0]
|| $self->{'dba'}->get_MetaContainer->list_value_by_key("name")->[0]
);
if($local) {
$self->{'meadow'} = Bio::EnsEMBL::Hive::Meadow::LOCAL->new();
......
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