Update of /cvsroot/perl-xml/xml-simple/lib/XML
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14674/lib/XML
Modified Files:
Simple.pm
Log Message:
- fix inconsistencies in SuppressEmpty with XMLout
Index: Simple.pm
===================================================================
RCS file: /cvsroot/perl-xml/xml-simple/lib/XML/Simple.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- Simple.pm 17 Nov 2004 08:35:12 -0000 1.21
+++ Simple.pm 17 Nov 2004 08:36:49 -0000 1.22
@@ -1375,6 +1375,7 @@
my $value = $ref->{$key};
next if(substr($key, 0, 1) eq '-');
if(!defined($value)) {
+ next if $self->{opt}->{suppressempty};
unless(exists($self->{opt}->{suppressempty})
and !defined($self->{opt}->{suppressempty})
) {
@@ -1384,7 +1385,7 @@
$text_content = '';
}
else {
- $value = {};
+ $value = exists($self->{opt}->{suppressempty}) ? {} : '';
}
}
@@ -2477,10 +2478,11 @@
the empty string respectively. The latter two alternatives are a little
easier to test for in your code than a hash with no keys.
-The option also controls what C<XMLout()> does with undefined values.
-Setting the option to undef causes undefined values to be output as
-empty elements (rather than empty attributes), it also suppresses the
-generation of warnings about undefined values.
+The option also controls what C<XMLout()> does with undefined values. Setting
+the option to undef causes undefined values to be output as empty elements
+(rather than empty attributes), it also suppresses the generation of warnings
+about undefined values. Setting the option to a true value (eg: 1) causes
+undefined values to be skipped altogether on output.
=head2 ValueAttr => [ names ] I<# in - handy>
|