File: parse

package info (click to toggle)
libgraph-easy-perl 0.71-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,284 kB
  • sloc: perl: 24,909; makefile: 2
file content (39 lines) | stat: -rwxr-xr-x 783 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl -w

BEGIN { $|++; }

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

print "# Graph::Easy v$Graph::Easy::VERSION\n";

my $file = shift;
$file = \*STDIN unless defined $file;
my $id = shift || '';
my $debug = shift || 0;

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

my $graph = $parser->from_file( $file );

print "# input: '$file'\n";

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

print "# Graph has ", scalar $graph->nodes(),
      " nodes and ", scalar $graph->edges()," edges.\n";

$graph->id($id);
$graph->timeout(240);
$graph->layout();

warn ($graph->error()) if $graph->error();

print $graph->as_txt();

print $graph->as_ascii(), "\n";

print "<style type='text/css'>\n<!--\n", 
      $graph->css(), "--></style>\n", $graph->as_html();