Fix iwla_convert.pl : skip empty key in hashs. Checks for empty lists

This commit is contained in:
Gregory Soutade 2017-09-05 08:07:23 +02:00
parent 9f9bfebe7a
commit 4466d9ac1d
1 changed files with 4 additions and 2 deletions

View File

@ -17,6 +17,7 @@ sub dumpList {
foreach $r (@list) foreach $r (@list)
{ {
$r =~ s/\'/\\\'/g; $r =~ s/\'/\\\'/g;
if ($first == 0) if ($first == 0)
{ {
print $FIC ", "; print $FIC ", ";
@ -37,6 +38,7 @@ sub dumpHash {
while( my ($k,$v) = each(%hash) ) { while( my ($k,$v) = each(%hash) ) {
$k =~ s/\'/\\\'/g; $k =~ s/\'/\\\'/g;
$v =~ s/\'/\\\'/g; $v =~ s/\'/\\\'/g;
next if ($k == "" || $v == "");
if ($first == 0) if ($first == 0)
{ {
print $FIC ", "; print $FIC ", ";
@ -56,7 +58,7 @@ print $FIC "#This file was automatically generated by iwla_convert.pl. Do not ed
print $FIC "robots = ["; print $FIC "robots = [";
dumpList(\@RobotsSearchIDOrder_list1, $FIC, 1); dumpList(\@RobotsSearchIDOrder_list1, $FIC, 1);
dumpList(\@RobotsSearchIDOrder_list2, $FIC, 0); dumpList(\@RobotsSearchIDOrder_list2, $FIC, (@RobotsSearchIDOrder_list1 == 0) ? 1 : 0);
print $FIC "]\n\n"; print $FIC "]\n\n";
print $FIC "search_engines = ["; print $FIC "search_engines = [";
@ -65,7 +67,7 @@ print $FIC "]\n\n";
print $FIC "search_engines_2 = ["; print $FIC "search_engines_2 = [";
dumpList(\@SearchEnginesSearchIDOrder_list2, $FIC, 1); dumpList(\@SearchEnginesSearchIDOrder_list2, $FIC, 1);
dumpList(\@Own_SearchEnginesSearchIDOrder, $FIC, 0); dumpList(\@Own_SearchEnginesSearchIDOrder, $FIC, (@SearchEnginesSearchIDOrder_list2 == 0) ? 1 : 0);
print $FIC "]\n\n"; print $FIC "]\n\n";
print $FIC "not_search_engines_keys = {"; print $FIC "not_search_engines_keys = {";