headers: assign zeroes to avoid undef errors

This commit is contained in:
Matt Simerson 2013-04-29 23:51:35 -04:00
parent b126c3c7f8
commit 4aa888dc6c

View File

@ -138,7 +138,7 @@ sub hook_data_post {
return DECLINED if $self->is_immune(); return DECLINED if $self->is_immune();
my $errors = $self->has_required_headers( $header ); my $errors = $self->has_required_headers( $header ) || 0;
$errors += $self->has_singular_headers( $header ); $errors += $self->has_singular_headers( $header );
my $err_msg = $self->invalid_date_range(); my $err_msg = $self->invalid_date_range();
@ -158,7 +158,7 @@ sub hook_data_post {
sub has_required_headers { sub has_required_headers {
my ($self, $header) = @_; my ($self, $header) = @_;
my $errors; my $errors = 0;
foreach my $h (@required_headers) { foreach my $h (@required_headers) {
next if $header->get($h); next if $header->get($h);
$errors++; $errors++;
@ -173,7 +173,7 @@ sub has_required_headers {
sub has_singular_headers { sub has_singular_headers {
my ($self, $header) = @_; my ($self, $header) = @_;
my $errors; my $errors = 0;
foreach my $h (@singular_headers) { foreach my $h (@singular_headers) {
next if !$header->get($h); # doesn't exist next if !$header->get($h); # doesn't exist
my @qty = $header->get($h); my @qty = $header->get($h);