Commit 794d1805 authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

Allow running generate_graph.pl with a format but no output file (use stdout)

parent 3a1ed4c2
......@@ -185,9 +185,13 @@ sub _as_debug {
$text=~s/\bcomment="new_shape:(\w+)",\s(.*shape=)"record"/$2"$1"/mg;
if(my $dot_input_filename = $self->dot_input_filename) {
open(my $dot_input, ">", $dot_input_filename) or die "cannot open > $dot_input_filename : $!";
print $dot_input $text;
close $dot_input;
if (ref($dot_input_filename)) {
print $dot_input_filename $text;
} else {
open(my $dot_input, ">", $dot_input_filename) or die "cannot open > $dot_input_filename : $!";
print $dot_input $text;
close $dot_input;
}
}
return $text;
......
......@@ -73,7 +73,7 @@ sub main {
$pipeconfig_object->add_objects_from_config( $self->{'pipeline'} );
}
if($self->{'output'}) {
if($self->{'output'} or $self->{'format'}) {
if(!$self->{'format'}) {
if($self->{'output'}=~/\.(\w+)$/) {
......@@ -98,12 +98,12 @@ sub main {
my $graphviz = $graph->build();
if( $self->{'format'} eq 'dot' ) { # If you need to take a look at the intermediate dot file
$graphviz->dot_input_filename( $self->{'output'} );
$graphviz->dot_input_filename( $self->{'output'} || \*STDOUT);
$graphviz->as_canon( '/dev/null' );
} else {
my $call = 'as_'.$self->{'format'};
$graphviz->$call($self->{'output'});
$graphviz->$call($self->{'output'} || \*STDOUT);
}
}
......
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