use Graph;
use Graph::Reader::Dot;
use IPC::Run qw/ run binary /;
+use Text::Tradition::Error;
@EXPORT_OK = qw/ make_character_matrix character_input phylip_pars
parse_newick newick_to_svg /;
# And then we run the program.
my $program = File::Which::which( 'pars' );
unless( -x $program ) {
- return( undef, "Phylip pars not found in path" );
+ throw( "Phylip pars not found in path" );
}
{
@outtree = <TREE>;
close TREE;
}
- return( 1, join( '', @outtree ) ) if @outtree;
+ return join( '', @outtree ) if @outtree;
my @error;
if( -f "$phylip_dir/outfile" ) {
} else {
push( @error, "Neither outtree nor output file was produced!" );
}
- return( undef, join( '', @error ) );
+ throw( join( '', @error ) );
}
sub parse_newick {
my $newick = shift;
my $program = File::Which::which( 'figtree' );
unless( -x $program ) {
- warn "FigTree commandline utility not found in path";
- return;
+ throw( "FigTree commandline utility not found in path" );
}
my $svg;
my $nfile = File::Temp->new();
_add_tree_children( $graph, $child, $c->get_children() );
}
}
+
+sub throw {
+ Text::Tradition::Error->throw(
+ 'ident' => 'StemmaUtil error',
+ 'message' => $_[0],
+ );
+}
+