[Libguestfs] [PATCH 4/6] LibVirtXML: Fix errors introduced by 78f88208

Matthew Booth mbooth at redhat.com
Tue Feb 9 16:01:17 UTC 2010


dom and path weren't being stored in the newly constructed object.
---
 lib/Sys/VirtV2V/Connection/LibVirtXML.pm |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/Sys/VirtV2V/Connection/LibVirtXML.pm b/lib/Sys/VirtV2V/Connection/LibVirtXML.pm
index 5d0ebbc..874946a 100644
--- a/lib/Sys/VirtV2V/Connection/LibVirtXML.pm
+++ b/lib/Sys/VirtV2V/Connection/LibVirtXML.pm
@@ -64,8 +64,8 @@ sub new
 
     my ($path) = @_;
 
-    my %obj = ();
-    my $self = \%obj;
+    my $self = {};
+    $self->{path} = $path;
 
     bless($self, $class);
 
@@ -88,15 +88,11 @@ sub _get_dom
                                 path => $self->{path}, error => $!)));
 
     # Parse the input file
-    my $parser = new XML::DOM::Parser;
-    my $dom;
-    eval { $dom = $parser->parse ($xml); };
+    eval { $self->{dom} = new XML::DOM::Parser->parse ($xml); };
 
     # Display any parse errors
-    die(user_message(__x("Unable to parse {path}: {error}",
+    die(user_message(__x("Unable to parse domain from file {path}: {error}",
                          path => $self->{path}, error => $@))) if ($@);
-
-    return $dom;
 }
 
 =back
-- 
1.6.6




More information about the Libguestfs mailing list