Hi,
let's say that I have an object with a definition like:my $self = { _username => Polo, _user_tags = [], _user_pass => undef }
And I want to save the status of the object like an XML file.
I tried first with:
my $data = $xml->XMLout(%$self , XMLDecl => 1, OutputFile => $xmlf +ile, NoAttr=>1 );
which results in:
Options must be name=>value pairs (odd number supplied) at...
Then I tried
foreach (keys %$self) { $hash->{$_} = $self->{$_}; } my $data = $xml->XMLout($hash , XMLDecl => 1, OutputFile => $xmlfi +le, NoAttr=>1 );
with no luck:
Operation "==": no method found, left argument has no overloaded magic, right argument in overloaded package Net::IP at inc/XML/Simple.pm +line 1406
And afterwards:
$hash->{_username} = $self->{_username} $hash->{_user_tags} = $self->{_user_tags} $hash->{_user_pass} = $self->{_user_pass} my $data = $xml->XMLout($hash , XMLDecl => 1, OutputFile => $xmlfile, +NoAttr=>1 );
and that works as I expected giving the XML I need
And the question is, Why the different behaviour if all the options I tried are basically the same?
Thanks to all monks
In reply to XMLout $self hash by tritt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |