Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

new release 7.74, allow class to cooperate with non-validation classes

  • Loading branch information...
commit b4159cc1e0a7956c128978fbf57f75a45e0419f4 1 parent f7b0815
@alnewkirk authored
View
3  CHANGES
@@ -5,6 +5,9 @@ TODO (TBD)
? write new POD about cooperating with existing OO systems
? added a "TODO" section of POD to the main module
+7.74 (2012-07-03)
+ * allow class to cooperate with non-validation classes
+
7.72 (2012-07-02)
* main module POD changes
* renamed constructor replacement to initialize_validator
View
2  Makefile.PL
@@ -27,7 +27,7 @@ my %WriteMakefileArgs = (
"Module::Runtime" => 0,
"utf8" => 0
},
- "VERSION" => "7.73",
+ "VERSION" => "7.74",
"test" => {
"TESTS" => "t/*.t t/regression/*.t t/regression/filters/*.t t/regression/validators/*.t"
}
View
2  README
@@ -3,7 +3,7 @@ NAME
Framework
VERSION
- version 7.73
+ version 7.74
SYNOPSIS
package MyApp::User;
View
2  README.mkdn
@@ -4,7 +4,7 @@ Validation::Class - Self-Validating Object System and Data Validation Framework
# VERSION
-version 7.73
+version 7.74
# SYNOPSIS
View
2  dist.ini
@@ -4,7 +4,7 @@ author = Al Newkirk <anewkirk@ana.io>
license = Perl_5
copyright_holder = Al Newkirk
copyright_year = 2011
-version = 7.73
+version = 7.74
[MetaResources]
homepage = https://github.com/alnewkirk/Validation-Class
View
31 lib/Validation/Class/Prototype.pm
@@ -1403,26 +1403,39 @@ sub class {
my $child = $class_name->new(%settings);
- my $proto = $child->proto;
-
- if (defined $settings{'params'}) {
+ {
- $delimiter =~ s/([\.\+\-\:\,\\\/])/\\$1/g;
+ my $proto_method =
+ $child->can('proto') ? 'proto' :
+ $child->can('prototype') ? 'prototype' : undef
+ ;
- foreach my $name ($proto->params->keys) {
+ if ($proto_method) {
+
+ my $proto = $child->$proto_method;
- if ($name =~ /^$shortname$delimiter(.*)/) {
+ if (defined $settings{'params'}) {
- if ($proto->fields->has($1)) {
+ $delimiter =~ s/([\.\+\-\:\,\\\/])/\\$1/g;
+
+ foreach my $name ($proto->params->keys) {
- push @{$proto->fields->{$1}->{alias}}, $name;
+ if ($name =~ /^$shortname$delimiter(.*)/) {
+
+ if ($proto->fields->has($1)) {
+
+ push @{$proto->fields->{$1}->{alias}}, $name;
+
+ }
+
+ }
}
}
}
-
+
}
return $child;
Please sign in to comment.
Something went wrong with that request. Please try again.