On Sun, 15 Aug 2010, tony mancill wrote:
> The upstream appears to be dead, and there are other (Debian) users of
> libconfig-simple-perl who requested this change. I agree that either
> behavior is arbitrary, but since it can't behave both ways, would you be
> receptive to a patch for publican that treats the empty value as the
> default?
Coming back to the topic, I think you can draft a patch that works
instead.
- 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.
You might want a supplementary test however:
return "" if scalar(@$rv) == 0;
If the array is empty, we return an empty string.
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.
Cheers,
--
Raphaël Hertzog ◈ Debian Developer ◈ [Flattr=20693]
Follow my Debian News ▶ http://RaphaelHertzog.com (English)
▶ http://RaphaelHertzog.fr (Français)
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]