Codebase list libxml-libxml-simple-perl / 86e6de1
[svn-upgrade] new version libxml-libxml-simple-perl (0.91) Salvatore Bonaccorso 12 years ago
5 changed file(s) with 33 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
00
11 === version history for XML::LibXML::Simple
2
3 version 0.91: Mon Jul 11 22:40:02 CEST 2011
4 Fixes:
5 - forcearray option with one element
6 rt.cpan.org#69336 [Matt W Johnson]
27
38 version 0.90: Wed Jun 15 10:20:48 CEST 2011
49 Fixes:
00 --- #YAML:1.0
11 name: XML-LibXML-Simple
2 version: 0.90
2 version: 0.91
33 abstract: XML::LibXML based XML::Simple clone
44 author:
55 - Mark Overmeer
33
44 WriteMakefile
55 ( NAME => 'XML::LibXML::Simple'
6 , VERSION => '0.90'
6 , VERSION => '0.91'
77 , PREREQ_PM =>
88 { XML::LibXML => 1.64
99 , Test::More => 0.54
0 === README for XML-LibXML-Simple version 0.90
1 = Generated on Wed Jun 15 10:21:43 2011 by OODoc 2.00
0 === README for XML-LibXML-Simple version 0.91
1 = Generated on Mon Jul 11 22:40:07 2011 by OODoc 2.00
22
33 There are various ways to install this module:
44
88 (2) if you use Windows, have a look at http://ppm.activestate.com/
99
1010 (3) if you have downloaded this module manually (as root/administrator)
11 gzip -d XML-LibXML-Simple-0.90.tar.gz
12 tar -xf XML-LibXML-Simple-0.90.tar
13 cd XML-LibXML-Simple-0.90
11 gzip -d XML-LibXML-Simple-0.91.tar.gz
12 tar -xf XML-LibXML-Simple-0.91.tar
13 cd XML-LibXML-Simple-0.91
1414 perl Makefile.PL
1515 make # optional
1616 make test # optional
1717 make install
1818
1919 For usage, see the included manual-pages or
20 http://search.cpan.org/dist/XML-LibXML-Simple-0.90/
20 http://search.cpan.org/dist/XML-LibXML-Simple-0.91/
2121
2222 Please report problems to
2323 http://rt.cpan.org/Dist/Display.html?Queue=XML-LibXML-Simple
33 # Pod stripped from pm file by OODoc 2.00.
44 package XML::LibXML::Simple;
55 use vars '$VERSION';
6 $VERSION = '0.90';
6 $VERSION = '0.91';
77
88 use base 'Exporter';
99 use strict;
153153
154154 $opt{searchpath} ||= [];
155155 ref $opt{searchpath} eq 'ARRAY'
156 or $opt{searchpath} = [ $opt{searchpath} ];
157
158 my $fa = delete $opt{forcearray};
159 my @fa = ref $fa eq 'ARRAY' ? @$fa : defined $fa ? $fa : ();
160 $opt{forcearray_always} = (@fa==1 && !ref $fa[0] && $fa[0]);
161 $opt{forcearray_regex} = [ grep {ref $_ eq 'Regexp'} @fa ];
162
163 $opt{forcearray_elem} = {};
164 $opt{forcearray_elem}{$_} = 1 for grep !ref $_, @fa;
156 or $opt{searchpath} = [ $opt{searchpath} ];
157
158 my $fa = delete $opt{forcearray} || 0;
159 my (@fa_regex, %fa_elem);
160 if(ref $fa)
161 { foreach (ref $fa eq 'ARRAY' ? @$fa : $fa)
162 { if(ref $_ eq 'Regexp') { push @fa_regex, $_ }
163 else { $fa_elem{$_} = 1 }
164 }
165 }
166 else { $opt{forcearray_always} = $fa }
167 $opt{forcearray_regex} = \@fa_regex;
168 $opt{forcearray_elem} = \%fa_elem;
165169
166170 # Special cleanup for {keyattr} which could be arrayref or hashref,
167171 # which behave differently.
225229
226230 if(defined $d->{$k})
227231 { # Combine duplicate attributes into arrayref if required
228 if(ref $d->{$k} eq 'ARRAY')
229 { push @{$d->{$k}}, $v }
230 else { $d->{$k} = [ $d->{$k}, $v ] }
231 }
232 elsif(ref $v eq 'ARRAY')
233 { push @{$d->{$k}}, $v }
232 if(ref $d->{$k} eq 'ARRAY') { push @{$d->{$k}}, $v }
233 else { $d->{$k} = [ $d->{$k}, $v ] } }
234 elsif(ref $v eq 'ARRAY') { push @{$d->{$k}}, $v }
234235 elsif(ref $v eq 'HASH'
235236 && $k ne $opts->{contentkey}
236 && $opts->{forcearray_always})
237 { push @{$d->{$k}}, $v }
237 && $opts->{forcearray_always}) { push @{$d->{$k}}, $v }
238238 elsif($opts->{forcearray_elem}{$k}
239239 || grep {$k =~ $_} @{$opts->{forcearray_regex}}
240 )
241 { push @{$d->{$k}}, $v }
242 else
243 { $d->{$k} = $v;
244 }
240 ) { push @{$d->{$k}}, $v }
241 else { $d->{$k} = $v }
245242 $d->{$k};
246243 }
247244