On Mon, 16 Aug 2010 09:58:26 +0200, Raphael Hertzog wrote: > Coming back to the topic, I think you can draft a patch that works > instead.
Thanks for taking the time to look into this issue! > - defined($rv) or return; > + defined($rv->[0]) or return ""; > > This changes is wrong. if $rv is not defined, we want an undef value. > Otherwise you get "" for a value that doesn't exist in the config file... > that's what breaks publican IMO. Right. > You might want a supplementary test however: > return "" if scalar(@$rv) == 0; > > If the array is empty, we return an empty string. Looks good. > for ( my $i=0; $i < @$rv; $i++ ) { > $rv->[$i] =~ s/\\n/\n/g; > } > - return @$rv==1 ? $rv->[0] : (wantarray ? @$rv : $rv); > + return @$rv<=1 ? $rv->[0] : (wantarray ? @$rv : $rv); > > If you stop above on an empty array, then this change is not needed IMO. Ack. I've now replaced the old patch with your proposal [0], and both the test suite and the test.pl from #365190 pass with it. Tony, what do you think about that? (Committed in svn) Cheers, gregor [0] http://dorf.mancill.com/websvn/filedetails.php?repname=deb&path=%2Flibconfig-simple-perl%2Ftrunk%2Fdebian%2Fpatches%2Fempty_string.patch -- .''`. http://info.comodo.priv.at/ -- GPG key IDs: 0x8649AA06, 0x00F3CFE4 : :' : Debian GNU/Linux user, admin, & developer - http://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of Free Software Foundation Europe `- NP: Tom Waits: Goin Out West
signature.asc
Description: Digital signature