Skip to content

Instantly share code, notes, and snippets.

@jjn1056
Created June 30, 2010 20:07
Show Gist options
  • Save jjn1056/459147 to your computer and use it in GitHub Desktop.
Save jjn1056/459147 to your computer and use it in GitHub Desktop.
while(%type_constraints) {
my($key, $type_constraint) = each %type_constraints;
delete $type_constraints{$key};
if(exists $values{$key}) {
my $value = $values{$key};
delete $values{$key};
unless($type_constraint->check($value)) {
my $message = $type_constraint->get_message($value);
warn "check $value for ".$type_constraint->name;
if(ref $_[2]) {
push @{$_[2]->{message}}, $type_constraint->get_message($value)
if ref $_[2];
return;
} else {
warn "no place to stick $message";
return;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment