Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Custom Filter Issue #7

Closed
alnewkirk opened this Issue · 7 comments

2 participants

Al Newkirk ifim
Al Newkirk
Owner

custom filters not being executed at all?

Al Newkirk alnewkirk closed this
ifim

I'm trying to run the example on filters, but yeah, they don't work at all. I copied the example almost verbatim except the line which uses Validate::Class instead of Validation::Class, there are several instances where the same typo appears in the main documentation.

$ perl -MMyApp::Person -e0
Can't locate object method "filter" via package "Validation::Class::Configuration" at /home/ifim/.perlbrew/libs/perl-5.16.2@validationclass/lib/perl5/Validation/Class/Prototype.pm line 1713.
Compilation failed in require at MyApp/Person.pm line 5.
BEGIN failed--compilation aborted at MyApp/Person.pm line 5.
Compilation failed in require.
BEGIN failed--compilation aborted.

You should reopen this issue, I may be able to lend a hand.

Al Newkirk
Owner

Thanks for the inquiry, which version of V::C are you running?
e.g. perl -MValidation::Class -E 'say $Validation::Class::VERSION'

ifim

It returns me an uninitialized value error. The Validation::Class package doesn't hold a $VERSION variable, but Makefile.PL does contain it:

grep -i version Makefile.PL
  "VERSION" => "7.900031",
unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };

So far, I've found/changed this:

diff --git a/lib/Validation/Class/Prototype.pm b/lib/Validation/Class/Prototype.pm
index 550ddaf..ff9f149 100644
--- a/lib/Validation/Class/Prototype.pm
+++ b/lib/Validation/Class/Prototype.pm
@@ -1710,7 +1710,7 @@ sub register_filter {

     my ($self, $name, $code) = @_;

-    $self->configuration->filter->add($name, $code);
+    $self->configuration->filters->add($name, $code);

     return $self;

But the custom filters don't seem to affect the fields yet.

Al Newkirk
Owner

OH, {o_o}, Sorry about that, I'll fix that right now. Let me know if you find anything else.

Al Newkirk
Owner

Releasing fix as part of Validation::Class version 7.900032, releasing now!

ifim

It does run smoothly now,

Al Newkirk
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.