XML::Registry - Perl module for loading and saving an XML registry.
use XML::Parser; use XML::Registry; # create a new XML::Parser instance using Tree Style $parser = new XML::Parser (Style => 'Tree'); # create new instance of XML::Registry $dump = new XML::Registry; # Convert XML Registry to Perl code $tree = $parser->parsefile($file); $tree = $parser->parse('<foo id="me">Hello World</foo>'); # print the results print $dump->xml2pl($tree); # Convert Perl code to XML Registry # read file in Data::Dumper format open(PL,$file) || die "Cannot open $file: $!"; $perl = eval(join("",<PL>)); # print the results print $dump->pl2xml($perl);
XML::Registry can dump an XML registry to Perl code using Data::Dumper, or dump Perl code into an XML registry.
This is done via the following 2 methods: XML::Registry::xml2pl XML::Registry::pl2xml
This module was originally written for an article in TPJ. It was an exercise in using the XML::Parser module.
Jonathan Eisenzopf, eisen@pobox.com
perl(1), XML::Parser(3).
To install XML::Registry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Registry
CPAN shell
perl -MCPAN -e shell install XML::Registry
For more information on module installation, please visit the detailed CPAN module installation guide.