#!/usr/bin/perl -w

# Convert an input file containing a Graph::Easy description to
# graphviz output that can be feed to dot etc.

# Example usage:
#  examples/as_graphviz t/in/2nodes.txt | dot -Tpng >test.png
#  echo "[ A ] -> [ B ]" | examples/as_graphviz | dot -Tpng >test.png

BEGIN { $|++; }

use strict;
use lib 'lib';
use Graph::Easy::Parser;

my $file = shift;

my $parser = Graph::Easy::Parser->new( debug => 0 );

$file = \*STDIN unless defined $file;
my $graph = $parser->from_file( $file );

die ($parser->error()) unless defined $graph;
print $graph->as_graphviz();

