]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fix rt #145095, undef warning in Perl before 5.12
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 11 Nov 2022 00:01:27 +0000 (16:01 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 11 Nov 2022 00:01:27 +0000 (16:01 -0800)
`length(undef)` issues a warning on Perl older than 5.12.

lib/Perl/Tidy/Formatter.pm

index 8252680a748383c08ae6808a37ed8f9ac08829db..cc4b02bde3fc40ee7706f19da8ae3cc727d76f8a 100644 (file)
@@ -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};