Subject: | StrMatch[] warns "Use of uninitialized value $_ in pattern match (m//)" and fails to validate properly |
Date: | Sun, 10 May 2020 08:41:39 -0500 |
To: | bug-Type-Tiny [...] rt.cpan.org |
From: | B K <ben.whosgonna.com [...] gmail.com> |
Hello,
I hope I'm using this correctly, but when i try to use StrMatch, I get a
warning message that "Use of uninitialized value $_ in pattern match
(m//)". Additionally, invalid values do not fail validation.
My sample code:
-----
use strict;
use warnings;
use Types::Standard 'StrMatch';
my $type = StrMatch[/foo/];
my $str = 'bar';
$type->assert_valid($str);
print "Didn't die\n";
-----
Running this gives:
Show quoted text
> Use of uninitialized value $_ in pattern match (m//) at
./TypesStandard_StrMatch_test.pl line 5.
Show quoted text> Didn't die
Perhaps I'm misreading the documentation or something similar.
Regards,
Ben Kaufman