Tuesday, December 29, 2009

Code of the Day

I haven't been able to post a lot because I've been working at work (and getting stuff done). To prove this point, here is my code that makes validating ±500 fields a lot easier. Don't get me started on why this is necessary in the first place when I should be able to use built-in checks. Suffice it to say, the guy is an idiot.


sub ah2_valid
{
my ( $c ) = @_;
my %errors;
my $data = $c->stash->{form}->get_values;
$c->log->info("*** ah2_valid ******");
foreach my $k (keys %{$c->req->body_params})
{
next unless $k =~ /^ah2/;
int_comma_err($data->{$k},\%errors,'ah2') if $data->{$k};
#print STDERR $c->req->body_params->{$k} . "\n";
}
return _set_custom_errors( $c , %errors ) ? 0: 's2/ag' ;
}



Happy New Year, if I don't get back here before Friday.

3 comments:

greeny said...

Happy New Year Anne! I send you the very best wishes possible!

VE said...

Well, my blog roll starts anew tomorrow. I'd be honored if you participate again in 2010. Leave a comment and you're on the blog roll! Thanks for visiting and commenting in 2009.

John said...

You lost me at "Code".