From: Junio C Hamano Date: Sun, 04 Jan 2009 05:30:37 GMT Subject: Re: [PATCH] gitweb: merge boolean feature subroutines Message-ID: <7vvdsv3af6.fsf@gitster.siamese.dyndns.org> In-Reply-To: <9b18b3110901030818i242d81ccl20ef3f264ec64cad@mail.gmail.com> demerphq writes: > 2009/1/3 Matt Kraai : > [...] >> -sub feature_blame { >> - my ($val) = git_get_project_config('blame', '--bool'); >> +sub feature_bool { >> + my $key = shift; >> + my ($val) = git_get_project_config($key, '--bool'); >> >> if ($val eq 'true') { >> return 1; > > Maybe that should be: > > return ($val eq 'true'); > > as It is not a good idea to use 0 as a replacement for perls false, as > the two have different behaviour. I'd rather want to keep our scripts free of deep Perl magic. Even if there are SVs that are interpreted as false other than 0, that does not necessarily mean you have to fear that 0 can sometimes evaluate to true. As long as you refrain from doing something crazy like "0 but true", people who are not (and/or are not inclined to become) familiar with the gory innards of Perl can rely on 0 being false and 1 being true when calling feature_something subs, no?