From: Tomas Doran (t0m) Date: Sun, 28 Jun 2009 12:52:28 +0000 (+0100) Subject: Initial patch from Bruno for implementing a ::Storage::Format::XML X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Storage.git;a=commitdiff_plain;h=207b646bb9f1f7778bb8b5d7564bf277581c5a0e Initial patch from Bruno for implementing a ::Storage::Format::XML --- diff --git a/lib/MooseX/Storage/Util.pm b/lib/MooseX/Storage/Util.pm index fdfbf96..e11b33c 100644 --- a/lib/MooseX/Storage/Util.pm +++ b/lib/MooseX/Storage/Util.pm @@ -64,6 +64,20 @@ sub _inflate_yaml { return $data; } +sub _inflate_xml { + my ($class, $xml) = @_; + + eval { require XML::Simple; XML::Simple->import }; + confess "Could not load XML::Simple module because : $@" if $@; + + my $data = eval { XMLin($xml, SuppressEmpty => 1) }; + if ($@) { + confess "There was an error when attempting to peek at XML: $@"; + } + + return $data; +} + 1; __END__