From: Jeff King Date: Mon, 23 Mar 2026 05:57:32 GMT Subject: Re: [PATCH 8/8] diff-highlight: fetch all config with one process Message-ID: <20260323055732.GB9976@coredump.intra.peff.net> In-Reply-To: <9818e3ec-838a-4eef-8436-a395f2970d42@malon.dev> On Mon, Mar 23, 2026 at 01:39:44PM +0800, Tian Yuchen wrote: > > I don't get any warning on perl 5.40.1. Are you seeing one on a > > different version? > > It's mainly because I saw that you changed the required version earlier: > > -require v5.26; > +require v5.008; > > I clearly remember that in older versions of Perl, the length function > behaved differently than it does now. Heh, it figures that dropping back the version requirement would bite me immediately. ;) > In 5.8.8 the output is: > > Use of uninitialized value in length at test.pl line 5. Yeah, looks like it changed in 5.12: https://www.effectiveperlprogramming.com/2010/09/in-perl-v5-12-lengthundef-returns-undef/ I had actually written it using exists() originally, but then dropped it to keep the diff smaller. Which is a silly reason. I've switched it to use: return defined($s) ? $s : $default; which I think captures the intent pretty clearly. You could also use "$s || $default", but I try to avoid that because of surprise-false values. In modern perl you could just use "//", but that wasn't added until v5.10. Thanks for pointing it out! -Peff