Config::Augeas::Exporter - Export the Augeas tree to various formats
use Config::Augeas::Exporter # Initiliaze my $aug = Config::Augeas::Exporter->new( root => $aug_root ); # Export to XML my $doc = $aug->to_xml( path => ['/files/etc/fstab', '/files/etc/apt'], exclude => ['#comment', '#mcomment'], file_stat => 1, ); print $doc->toString; # Restore from XML open (my $fh, "<$file") or die "E: Could not open $file: $!\n" ; my $doc = XML::LibXML->load_xml(IO => $fh); close $fh; my $aug = Config::Augeas::Exporter->new(root => $root); $aug->from_xml( xml => $doc, create_dirs => 1, );
This module allows to export the Augeas tree to various formats and import back from these formats to the configuration files.
Creates a new Config::Augeas::Exporter object. Optional parameters are:
A Config::Augeas object. If not provided, a new one will be created.
Use root as the filesystem root.
root
Export the Augeas tree to a XML::LibXML::Document object.
An array of Augeas paths to export. If ommitted, it will default to '/files'.
An array of label patterns to exclude from the export.
A boolean, whether to include file stat.
Export the Augeas tree to a hash.
path is the Augeas path to export. If ommitted, it will default to '/files'.
path
A list of label patterns to exclude from the export.
Export the Augeas tree to YAML.
Export the Augeas tree to JSON.
Restore the Augeas tree from an XML::LibXML::Document object. This method considers the files listed in the XML document, and replaces the corresponding files in the Augeas tree with the contents of the XML.
The XML::LibXML::Document to use as source for import.
Boolean value, whether to create the directories if missing.
Config::Augeas : The Config::Augeas module
http://augeas.net/ : The Augeas project page
Raphaël Pinson, <raphink at cpan dot org>
This module is developed on Launchpad at:
https://launchpad.net/config-augeas-exporter
Feel free to fork the repository and submit pull requests
Copyright (C) 2011 by Raphaël Pinson
This library is free software; you can redistribute it and/or modify it under the LGPL terms.
To install Config::Augeas::Exporter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Augeas::Exporter
CPAN shell
perl -MCPAN -e shell install Config::Augeas::Exporter
For more information on module installation, please visit the detailed CPAN module installation guide.