From: Tara L Andrews Date: Wed, 1 Feb 2012 00:03:09 +0000 (+0100) Subject: fix return value mod in distance_trees X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=69403daab6a116b2868b73adf3ac5b97e6c531db;p=scpubgit%2Fstemmatology.git fix return value mod in distance_trees --- diff --git a/lib/Text/Tradition/Stemma.pm b/lib/Text/Tradition/Stemma.pm index 9244580..35c0f1e 100644 --- a/lib/Text/Tradition/Stemma.pm +++ b/lib/Text/Tradition/Stemma.pm @@ -191,15 +191,11 @@ before 'distance_trees' => sub { || $args{'program'} ne $self->distance_program ) { # We need to make a tree before we can return it. my $dsub = 'run_' . $args{'program'}; - my( $ok, $result ) = $self->$dsub(); - if( $ok ) { - # Save the resulting trees - my $trees = parse_newick( $result ); - $self->_save_distance_trees( $trees ); - $self->distance_program( $args{'program'} ); - } else { - throw( "Failed to calculate distance trees: $result" ); - } + my $result = $self->$dsub(); # this might throw an error - catch it? + # Save the resulting trees + my $trees = parse_newick( $result ); + $self->_save_distance_trees( $trees ); + $self->distance_program( $args{'program'} ); } }; diff --git a/lib/Text/Tradition/StemmaUtil.pm b/lib/Text/Tradition/StemmaUtil.pm index 0158d61..15e7f89 100644 --- a/lib/Text/Tradition/StemmaUtil.pm +++ b/lib/Text/Tradition/StemmaUtil.pm @@ -146,6 +146,7 @@ sub phylip_pars { } return join( '', @outtree ) if @outtree; + # If we got this far, we are about to throw an error. my @error; if( -f "$phylip_dir/outfile" ) { open( OUTPUT, "$phylip_dir/outfile" ) or die "Could not open output for read";