From: Steve Hancock Date: Fri, 11 Nov 2022 00:01:27 +0000 (-0800) Subject: Fix rt #145095, undef warning in Perl before 5.12 X-Git-Tag: 20221112~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=64a5c34be02c3c8789809be2ebaea2ff2f78ea0e;p=perltidy.git Fix rt #145095, undef warning in Perl before 5.12 `length(undef)` issues a warning on Perl older than 5.12. --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 8252680a..cc4b02bd 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -2508,7 +2508,7 @@ sub initialize_trailing_comma_rules { $option =~ s/^\s+//; $option =~ s/\s+$//; } - if ( length($option) ) { + if ( defined($option) && length($option) ) { my $error_message; my %rule_hash; my @q = @{$rvalid_flags};