| 1 |
#!/usr/bin/perl -w |
| 2 |
|
| 3 |
BEGIN { $|++; } |
| 4 |
|
| 5 |
use strict; |
| 6 |
use lib 'lib'; |
| 7 |
use Graph::Easy::Parser; |
| 8 |
|
| 9 |
print "# Graph::Easy v$Graph::Easy::VERSION\n"; |
| 10 |
|
| 11 |
my $file = shift; |
| 12 |
$file = \*STDIN unless defined $file; |
| 13 |
my $id = shift || ''; |
| 14 |
my $debug = shift || 0; |
| 15 |
|
| 16 |
my $parser = Graph::Easy::Parser->new( debug => $debug ); |
| 17 |
|
| 18 |
my $graph = $parser->from_file( $file ); |
| 19 |
|
| 20 |
print "# input: '$file'\n"; |
| 21 |
|
| 22 |
die ($parser->error()) unless defined $graph; |
| 23 |
|
| 24 |
print "# Graph has ", scalar $graph->nodes(), |
| 25 |
" nodes and ", scalar $graph->edges()," edges.\n"; |
| 26 |
|
| 27 |
$graph->id($id); |
| 28 |
$graph->timeout(240); |
| 29 |
$graph->layout(); |
| 30 |
|
| 31 |
warn ($graph->error()) if $graph->error(); |
| 32 |
|
| 33 |
print $graph->as_txt(); |
| 34 |
|
| 35 |
print $graph->as_ascii(), "\n"; |
| 36 |
|
| 37 |
print "<style type='text/css'>\n<!--\n", |
| 38 |
$graph->css(), "--></style>\n", $graph->as_html(); |
| 39 |
|