Subject: | No value specified for 'ForceArray' option in call to XMLin() when used from mod_perl |
Linux 2.6.18-128.el5 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
CentOS release 5.3 (Final)
perl v5.8.8
mod_perl-2.0.4-6.el5
perl -MWeather::Com::Base -e 'print $Weather::Com::Base::VERSION;'
1.009
perl -MXML::Simple -e 'print $XML::Simple::VERSION;'
2.18
When i try to search with Weather::Com from the line, everything goes
all right.
But when i use it from mod_perl, XML::Simple runs in STRICT MODE (i
don't understand where/why this happens, but it does), it croaks
No value specified for 'ForceArray' option in call to XMLin() at
/usr/lib/perl5/site_perl/5.8.8/Weather/Com/Base.pm line 230
I saw, that you've already added the ForceArray option to get_weather
method, so would it be possible to add it also to the search method? My
suggestion is in the attached patchfile.
Thanks for your time.
Subject: | WeatherComBase.patch |
--- /usr/lib/perl5/site_perl/5.8.8/Weather/Com/Base.pm.orig 2010-04-12 15:41:04.000000000 +0200
+++ /usr/lib/perl5/site_perl/5.8.8/Weather/Com/Base.pm 2010-04-12 17:12:13.000000000 +0200
@@ -227,7 +227,12 @@
return 0 unless ( $locationXML =~ /^\<\?xml/ );
# parse answer
- my $simpleHash = XMLin($locationXML);
+ my %options = (
+ ForceArray => [ qw(loc content id) ],
+ KeyAttr => { 'loc' => 'content', 'loc' => 'id' }
+ );
+
+ my $simpleHash = XMLin($locationXML, %options);
# XML::Simple behaves differently when one location is return than
# when more locations are returned ...