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

πŸ’– Graph::Writer::XML β€” the vibe πŸ’–

okay bestie, so this is Graph::Writer::XML(3pm) β€” a lil page from the User Contributed Perl Documentation corner of the internet, and it's literally here to teach you how to turn a directed graph into XML. no cap. πŸ¦‹


✨ NAME ✨

Graph::Writer::XML β€” write out a directed graph as XML πŸŽ€


🌸 SYNOPSIS 🌸

use Graph;
use Graph::Writer::XML;

$graph = Graph->new();
# add edges and nodes to the graph

$writer = Graph::Writer::XML->new();
$writer->write_graph($graph, 'mygraph.xml');

πŸ’… DESCRIPTION πŸ’…

So Graph::Writer::XML is a class whose whole entire job β€” its main character moment, if you will β€” is writing out a directed graph in a simple XML format. 🌈

The graph has to be an instance of the Graph class. and like, that's not just one class, it's actually a whole set of classes developed by Jarkko Hietaniemi. so jot that down. πŸ“

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 the graph, the nodes, and the edges can all have attributes specified β€” where an attribute is a (name,value) pair, and the value is a scalar. that's the whole deal. ✨


πŸ‘‘ METHODS πŸ‘‘

πŸ’œ new()

Constructor β€” it makes you a brand new writer instance. 🫢

$writer = Graph::Writer::XML->new();

This one doesn't take any arguments. not a single one. she's low maintenance like that. πŸ™ˆ

πŸ’œ write_graph()

Write a specific graph to a named file:

$writer->write_graph($graph, $file);

The $file argument can either be a filename, or a filehandle for a file you already opened earlier. your choice bestie, both are valid. πŸ”₯


πŸ’€ KNOWN BUGS πŸ’€

Attribute values must be scalar. if they're not... well. you're on your own. 😭 no rescue, no lifeline, just vibes and consequences. good luck out there. πŸ“


🌟 SEE ALSO 🌟

  • XML::Writer β€” the perl module that actually does the writing of the XML. it handles entities and all that etc. ✨
  • Graph β€” Jarkko Hietaniemi's modules for representing directed graphs, available from CPAN under modules/by-module/Graph/. iconic. πŸ‘‘
  • Algorithms in Perl β€” the O'Reilly book which has a chapter on directed graphs, and that chapter is based around Jarkko's modules. πŸ“š
  • Graph::Writer β€” the base-class for Graph::Writer::XML. her mother, her origin story. 🧚

πŸŽ€ REPOSITORY πŸŽ€

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


πŸ’– AUTHOR πŸ’–

Neil Bowers <neil@bowers.com> β€” ty king 🫢


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

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


okay that's the whole page, we ate and left no crumbs πŸ’… and fr fr, this doc came to you courtesy of perl v5.32.1, dated 2021-09-19, straight from User Contributed Perl Documentation β€” slay, bye bestie! πŸŒˆβœ¨πŸ’œ

πŸ“¦ where this page comes from