The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

OGDL::Parser - OGDL parser class

SYNOPSIS

  use OGDL::Parser;
  #Two easy interfaces
  $g=OGDL::Parser::fileToGraph($filename);
  #or parsing a string
  $g=OGDL::Parser::stringToGraph($string);

  #Another way to use the parser 
  #This method allows passing of any file handle to the parser
  $parser=OGDL::Parser->new;
  $parser->read(*STDIN);
  # $g is an OGDL::Graph object
  $g=$parser->parse;
  # print the whole graph.
  $g->print;

DESCRIPTION

OGDL possibly is a human editable alternative to XML. For details please see http://ogdl.sourceforge.net/. This class will parse an ogdl conformed file or string into an OGDL::Graph object.

METHODS

$g=OGDL::Parser::fileToGraph($filename) This is a simple way of parsing an ogdl file. The method accepts filename and returns an OGDL::Graph object parsed from the file. It returns undef if the parsing failed for any reason.

$g=OGDL::Parser::stringToGraph($string) This provides an easy way to parse an ogdl content held in memory. It accepts a string and returnes an OGDL::Graph object parsed from the string. It returns undef if the parsing failed.

$p=OGDL::Parser->new($rootname) This method constructs an OGDL::Parser object. If $rootname is provided, it uses $rootname as the name of the rootnode for the graph to parsed.

$p->read(*FILEHANDLE) This method reads in text into its internal buffer and make it ready for parsing. The method can be used several times to read in contents from different sources. The resulting ogdl graph will be a plain combination of all the contents.

$p->append($str) This method adds $str to its internal buffer and make it ready for parsing.

$g=$p->parse This method parses its internal buffer and returns the OGDL::Graph object from parsing. It returns undef if parsing fails.

SEE ALSO OGDL::Graph, http://ogdl.sourceforge.net/.