Skip Menu |

This queue is for tickets about the Params-Validate CPAN distribution.

Report information
The Basics
Id: 15196
Status: resolved
Priority: 0/
Queue: Params-Validate

People
Owner: Nobody in particular
Requestors: bmc [...] snort.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.77
Fixed in: 0.80



Subject: ValidateXS should validate that data is defined before use
When using Params::ValidateXS with warnings enabled and param is validated that has the value of undef, then you get the following warning: Use of uninitialized value in pattern match (m//) at /usr/local/lib/perl/5.8.4/Params/ValidateXS.pm line 52. instead of: sub _check_regex_from_xs { return $_[0] =~ /$_[1]/ ? 1 : 0 } Perhaps this: sub _check_regex_from_xs { return 0 if !defined($_[0]); return $_[0] =~ /$_[1]/ ? 1 : 0 } example for testing, before patch regex warnings. after patch, no warnings. Still fails to validate. use warnings; my @a = ( foo => undef); validate( @a, { foo => { regex => qr/^bar/ , optional => 1}, } );