Skip Menu |

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

Maintainer(s)' notes

This is the bug queue for Data::FormValidator.

Report information
The Basics
Id: 78443
Status: open
Priority: 0/
Queue: Data-FormValidator

People
Owner: Nobody in particular
Requestors: michael.jemmeson [...] gmail.com
Cc:
AdminCc:

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



Subject: Multiple Constraints in docs - incorrect?
The section of the documentation on multiple constraints for a single field (https://metacpan.org/module/Data::FormValidator#MULTIPLE-CONSTRAINTS) gives the following as an example: my_zipcode_field => [ 'zip', { constraint => '/^406/', name => 'starts_with_406', } ], However, that results in a fatal error at line 969 (die "Value for constraint_method within hashref '$val->{constraint_method}' not a code reference or Regexp . Do you need func(), not 'func'?";) The following appears to work: my_zipcode_field => [ 'zip', { constraint_method => '/^406/', name => 'starts_with_406', } ], thanks
Subject: Re: [rt.cpan.org #78443] Multiple Constraints in docs - incorrect?
Date: Mon, 30 Jul 2012 13:39:59 -0400
To: bug-Data-FormValidator [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
On 07/18/2012 06:45 AM, M Jemmeson via RT wrote: Show quoted text
> Wed Jul 18 06:45:43 2012: Request 78443 was acted upon. > Transaction: Ticket created by mjemmeson > Queue: Data-FormValidator > Subject: Multiple Constraints in docs - incorrect? > Broken in: (no value) > Severity: Normal > Owner: Nobody > Requestors: michael.jemmeson@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78443 > > > > The section of the documentation on multiple constraints for a single field > (https://metacpan.org/module/Data::FormValidator#MULTIPLE-CONSTRAINTS) > gives the following as an example: > > my_zipcode_field => [ > 'zip', > { > constraint => '/^406/', > name => 'starts_with_406', > } > ], > > However, that results in a fatal error at line 969 > (die "Value for constraint_method within hashref '$val->{constraint_method}' not a code > reference or Regexp . Do you need func(), not 'func'?";) > > > The following appears to work: > my_zipcode_field => [ > 'zip', > { > constraint_method => '/^406/', > name => 'starts_with_406', > } > ],
You are right, this area of the docs could improved. The snippet had the older constraints => {} section in mind. It should be updated to use the 'constraint_methods' declaration style, and provide more context to clarify that's what's going on. Mark
On Mon Jul 30 13:40:10 2012, mark@summersault.com wrote: Show quoted text
> On 07/18/2012 06:45 AM, M Jemmeson via RT wrote:
> > Wed Jul 18 06:45:43 2012: Request 78443 was acted upon. > > Transaction: Ticket created by mjemmeson > > Queue: Data-FormValidator > > Subject: Multiple Constraints in docs - incorrect? > > Broken in: (no value) > > Severity: Normal > > Owner: Nobody > > Requestors: michael.jemmeson@gmail.com > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78443 > > > > > > > The section of the documentation on multiple constraints for a single > > field > > (https://metacpan.org/module/Data::FormValidator#MULTIPLE- > > CONSTRAINTS) > > gives the following as an example: > > > > my_zipcode_field => [ > > 'zip', > > { > > constraint => '/^406/', > > name => 'starts_with_406', > > } > > ], > > > > However, that results in a fatal error at line 969 > > (die "Value for constraint_method within hashref '$val-
> > >{constraint_method}' not a code
> > reference or Regexp . Do you need func(), not 'func'?";) > > > > > > The following appears to work: > > my_zipcode_field => [ > > 'zip', > > { > > constraint_method => '/^406/', > > name => 'starts_with_406', > > } > > ],
> > You are right, this area of the docs could improved. > > The snippet had the older constraints => {} section in mind. > > It should be updated to use the 'constraint_methods' declaration > style, > and provide more context to clarify that's what's going on. > > Mark
Applied to the fork https://github.com/dnmfarrell/Data-FormValidator/commit/3bcd0e2b315ddced370b5cd9104ec10eb9ea273b