Graph:...r::XML(3pm)

πŸ’– Graph::Reader::XML πŸ’–

okay so bestie, welcome to Graph::Reader::XML, a perl class from the User Contributed Perl Documentation crew, and she is literally the moment. she reads directed graphs that are chilling in XML and hands you back a whole Graph object. no cap. πŸ’…


✨ NAME ✨

Graph::Reader::XML β€” class for reading a Graph instance from XML


πŸŽ€ SYNOPSIS πŸŽ€

use Graph::Reader::XML;
use Graph;

$reader = Graph::Reader::XML->new();
$graph = $reader->read_graph('mygraph.xml');

like... that's it. that's the whole vibe. πŸ¦‹


🌸 DESCRIPTION 🌸

so Graph::Reader::XML is a perl class that reads a directed graph stored as XML and gives you back an instance of the Graph class. it's giving "translator bestie" energy fr fr.

the XML format is designed to support the Graph classes β€” it can represent a single graph with a collection of nodes, and edges between those nodes. and here's the slay part: the graph, the nodes, and the edges can all have attributes specified. everyone gets accessories. πŸ’…βœ¨

also important: Graph::Reader::XML is a subclass of Graph::Reader, which is the one that defines the generic interface for Graph reader classes. so she's not doing her own thing, she's following the family blueprint. periodt.


πŸ‘‘ METHODS πŸ‘‘

new()

constructor β€” generate a new reader instance. iconic behavior.

$reader = Graph::Reader::XML->new();

she does not take any arguments. don't come at her with arguments, she's not interested. πŸ™ˆ

read_graph()

read a graph from a file:

$graph = $reader->read_graph( $file );

the $file argument can be either a filename or a filehandle of a previously opened file. so like, whichever one you've got, she'll work with it. flexible queen. 🌈


πŸ’€ KNOWN BUGS πŸ’€

attribute values must be scalar. if they're not, well... you're on your own. 😭 like genuinely, bestie, she said good luck and walked away. no further explanation, no safety net, nothing.


🫢 SEE ALSO 🫢

  • Graph::Reader β€” the base class for Graph::Reader::XML. the parent, the blueprint, the origin story.
  • Graph::Writer::XML β€” used to serialise a Graph instance as XML. the other direction bestie!
  • Graph β€” Jarkko Hietaniemi's classes for representing directed graphs. the whole reason we're here.

⭐ REPOSITORY ⭐

<https://github.com/neilb/Graph-ReadWrite>

come hang out, the code lives there πŸ“


🌟 AUTHOR 🌟

Neil Bowers <neil@bowers.com>


Copyright (c) 2001-2012, Neil Bowers. All rights reserved. Copyright (c) 2001, Canon Research Centre Europe. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page bestie!! πŸŽ€ this was perl v5.32.1, dated 2021-09-19, and it's Graph::Reader::XML(3pm) β€” go read some XML and make a graph, i'm obsessed with you, mwah πŸ’–βœ¨

πŸ“¦ where this page comes from