Subject: | Warning |
This is not an error, but a warning that appears hundred of times when I
run a project using "-w":
Use of uninitialized value in pattern match (m//) at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 33.
Use of uninitialized value in subroutine entry at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 24.
Use of uninitialized value in pattern match (m//) at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 33.
Use of uninitialized value in subroutine entry at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 24.
Use of uninitialized value in pattern match (m//) at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 33.
Use of uninitialized value in subroutine entry at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 24.
Use of uninitialized value in pattern match (m//) at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 33.
Use of uninitialized value in subroutine entry at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 24.
Use of uninitialized value in pattern match (m//) at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 33.
Use of uninitialized value in subroutine entry at
/Library/Perl/5.8.6/Template/Provider/Encoding.pm line 24.
Here's a possible solution:
33 $data->{text} ||= ''; # avoid undefined value warnings
34 my $encoding = $data->{text} =~ /^\[% USE encoding '([\w\-]+)'/
35 ? $1 : $self->{DEFAULT_ENCODING};
In other words: define $data->{text} before testing it.