Skip Menu |
 

This queue is for tickets about the Data-TreeValidator CPAN distribution.

Report information
The Basics
Id: 77654
Status: resolved
Priority: 0/
Queue: Data-TreeValidator

People
Owner: Nobody in particular
Requestors: FRIEDMAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.03
Fixed in: (no value)



First, thanks for your work on this module. Example: my $rdv = leaf(constraints => [required]); $rdv->process(0); should pass, but it fails the required test. The documentation is a bit imprecise. In POD of Data::TreeValidator::Constraints, "required" is described as "defined, and stringifies to a true value (not the empty string)". That's confusing because, despite the suggestive parentheses, "stringifies to a true value" is not the same thing as "not the empty string": 0 is not the empty string, but also does not stringify to a true value. On the other hand, look at the code for required: fail_constraint("Required") unless defined $_ && "$_" ne ''; It is clear that "not the empty string" is the desired test, and stringifies to a true value is not what is actually tested. So 0 should pass required. I believe the bug is line 46 of Data::TreeValidator::Leaf my $process = $input || $args{initialize}; Here $input of 0 gets converted to undef, and later on appears to be missing. It should of course be my $process = defined $input ? $input : $args{initialize};
This has been resolved in 0.04


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.