Subject: | Fix for " Use of uninitialized value $_ in pattern match (m//)" |
When pragma "warnings" and "-w" are enabled while calling propmpt()
there are warnings like :
Use of uninitialized value $_ in pattern match (m//) at
.../lib/IO/Prompt.pm line 91.
Run attached "test-IO-Prompt.pl" for demonstration of issue.
Patch is attached in the file "patch-Prompt.pm".
Subject: | patch-Prompt.pm |
--- Prompt.pm
+++ Prompt.pm
@@ -88,6 +88,7 @@
@data = map { $flags_alias{$_} || $_ } @data;
for (my $i = 0 ; $i < @data ; $i++) {
local *_ = \($data[$i]);
+ next unless defined $_;
if (ref eq 'HASH') {
splice @data, $i + 1, 0, %$_;
}
Subject: | test-IO-Prompt.pl |
#!/usr/bin/perl -Tw
use strict;
use warnings;
use IO::Prompt;
my $res = prompt( -prompt => "Enter something:");