GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Graph::Easy::Parser::VCG(3) User Contributed Perl Documentation Graph::Easy::Parser::VCG(3)

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

        # creating a graph from a textual description

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

        my $graph = $parser->from_text(
                "graph: { \n" .
                "       node: { title: "Bonn" }\n" .
                "       node: { title: "Berlin" }\n" .
                "       edge: { sourcename: "Bonn" targetname: "Berlin" }\n" .
                "}\n"
        );
        print $graph->as_ascii();

        print $parser->from_file('mygraph.vcg')->as_ascii();

"Graph::Easy::Parser::VCG" parses the text format from the VCG or GDL (Graph Description Language) use by tools like GCC and AiSee, and constructs a "Graph::Easy" object from it.

The resulting object can then be used to layout and output the graph in various formats.

The output will be a Graph::Easy object (unless overridden with "use_class()"), see the documentation for Graph::Easy what you can do with it.

Attributes will be remapped to the proper Graph::Easy attribute names and values, as much as possible.

Anything else will be converted to custom attributes starting with "x-vcg-". So "dirty_edge_labels: yes" will become "x-vcg-dirty_edge_labels: yes".

"Graph::Easy::Parser::VCG" supports the same methods as its parent class "Graph::Easy::Parser":

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

Creates a new parser object. There are two valid parameters:

        debug
        fatal_errors

Both take either a false or a true value.

        my $parser = Graph::Easy::Parser::VCG->new( debug => 1 );
        $parser->from_text('graph: { }');

        $parser->reset();

Reset the status of the parser, clear errors etc. Automatically called when you call any of the "from_XXX()" methods below.

        $parser->use_class('node', 'Graph::Easy::MyNode');

Override the class to be used to constructs objects while parsing.

See Graph::Easy::Parser for further information.

        my $graph = $parser->from_text( $text );

Create a Graph::Easy object from the textual description in $text.

Returns undef for error, you can find out what the error was with error().

This method will reset any previous error, and thus the $parser object can be re-used to parse different texts by just calling "from_text()" multiple times.

        my $graph = $parser->from_file( $filename );
        my $graph = Graph::Easy::Parser::VCG->from_file( $filename );

Creates a Graph::Easy object from the textual description in the file $filename.

The second calling style will create a temporary parser object, parse the file and return the resulting "Graph::Easy" object.

Returns undef for error, you can find out what the error was with error() when using the first calling style.

        my $error = $parser->error();

Returns the last error, or the empty string if no error occurred.

        $parser->parse_error( $msg_nr, @params);

Sets an error message from a message number and replaces embedded templates like "##param1##" with the passed parameters.

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

Exports nothing.

Graph::Easy, Graph::Write::VCG.

Copyright (C) 2005 - 2008 by Tels <http://bloodgate.com>

See the LICENSE file for information.

2016-06-06 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.