1Graph::Easy::Parser::VCUGs(e3r)Contributed Perl DocumentGartaipohn::Easy::Parser::VCG(3)
2
3
4

NAME

6       Graph::Easy::Parser::VCG - Parse VCG or GDL text into Graph::Easy
7

SYNOPSIS

9               # creating a graph from a textual description
10
11               use Graph::Easy::Parser::VCG;
12               my $parser = Graph::Easy::Parser::VCG->new();
13
14               my $graph = $parser->from_text(
15                       "graph: { \n" .
16                       "       node: { title: "Bonn" }\n" .
17                       "       node: { title: "Berlin" }\n" .
18                       "       edge: { sourcename: "Bonn" targetname: "Berlin" }\n" .
19                       "}\n"
20               );
21               print $graph->as_ascii();
22
23               print $parser->from_file('mygraph.vcg')->as_ascii();
24

DESCRIPTION

26       "Graph::Easy::Parser::VCG" parses the text format from the VCG or GDL
27       (Graph Description Language) use by tools like GCC and AiSee, and
28       constructs a "Graph::Easy" object from it.
29
30       The resulting object can then be used to layout and output the graph in
31       various formats.
32
33   Output
34       The output will be a Graph::Easy object (unless overridden with
35       "use_class()"), see the documentation for Graph::Easy what you can do
36       with it.
37
38   Attributes
39       Attributes will be remapped to the proper Graph::Easy attribute names
40       and values, as much as possible.
41
42       Anything else will be converted to custom attributes starting with
43       "x-vcg-".  So "dirty_edge_labels: yes" will become
44       "x-vcg-dirty_edge_labels: yes".
45

METHODS

47       "Graph::Easy::Parser::VCG" supports the same methods as its parent
48       class "Graph::Easy::Parser":
49
50   new()
51               use Graph::Easy::Parser::VCG;
52               my $parser = Graph::Easy::Parser::VCG->new();
53
54       Creates a new parser object. There are two valid parameters:
55
56               debug
57               fatal_errors
58
59       Both take either a false or a true value.
60
61               my $parser = Graph::Easy::Parser::VCG->new( debug => 1 );
62               $parser->from_text('graph: { }');
63
64   reset()
65               $parser->reset();
66
67       Reset the status of the parser, clear errors etc. Automatically called
68       when you call any of the "from_XXX()" methods below.
69
70   use_class()
71               $parser->use_class('node', 'Graph::Easy::MyNode');
72
73       Override the class to be used to constructs objects while parsing.
74
75       See Graph::Easy::Parser for further information.
76
77   from_text()
78               my $graph = $parser->from_text( $text );
79
80       Create a Graph::Easy object from the textual description in $text.
81
82       Returns undef for error, you can find out what the error was with
83       error().
84
85       This method will reset any previous error, and thus the $parser object
86       can be re-used to parse different texts by just calling "from_text()"
87       multiple times.
88
89   from_file()
90               my $graph = $parser->from_file( $filename );
91               my $graph = Graph::Easy::Parser::VCG->from_file( $filename );
92
93       Creates a Graph::Easy object from the textual description in the file
94       $filename.
95
96       The second calling style will create a temporary parser object, parse
97       the file and return the resulting "Graph::Easy" object.
98
99       Returns undef for error, you can find out what the error was with
100       error() when using the first calling style.
101
102   error()
103               my $error = $parser->error();
104
105       Returns the last error, or the empty string if no error occurred.
106
107   parse_error()
108               $parser->parse_error( $msg_nr, @params);
109
110       Sets an error message from a message number and replaces embedded
111       templates like "##param1##" with the passed parameters.
112

CAVEATS

114       The parser has problems with the following things:
115
116       attributes  Some attributes are not remapped properly to what
117                   Graph::Easy expects, thus losing information, either
118                   because Graph::Easy doesn't support this feature yet, or
119                   because the mapping is incomplete.
120
121       comments    Comments written in the source code itself are discarded.
122                   If you want to have comments on the graph, clusters, nodes
123                   or edges, use the attribute "comment".  These are correctly
124                   read in and stored, and then output into the different
125                   formats, too.
126

EXPORT

128       Exports nothing.
129

SEE ALSO

131       Graph::Easy, Graph::Write::VCG.
132

AUTHOR

134       Copyright (C) 2005 - 2008 by Tels <http://bloodgate.com>
135
136       See the LICENSE file for information.
137
138
139
140perl v5.34.0                      2021-07-22       Graph::Easy::Parser::VCG(3)
Impressum