payment method only unknown when not defined

Assure reassignment of variable only happens inside conditional.
This commit is contained in:
Bradley M. Kuhn 2018-08-07 10:32:09 -07:00
parent d6375aefd6
commit 6b8f3fac77

View file

@ -54,8 +54,11 @@ my @ticketSpecs = TicketIDsReadyForPayment();
my %payments;
foreach my $ticketSpec (@ticketSpecs) {
my $paymentMethod = FindMostRecentPaymentMethodForTicket($ticketSpec);
warn "Cannot find payment method for ticket, $ticketSpec" unless defined $paymentMethod;
print STDERR "$ticketSpec has payment method of $paymentMethod\n" if ($VERBOSE > 6);
if (not defined $paymentMethod) {
warn "Cannot find payment method for ticket, $ticketSpec";
$paymentMethod = "UNKNOWN PAYMENT METHOD";
}
push(@{$payments{$paymentMethod}}, $ticketSpec);
}
foreach my $paymentMethod (sort { $a cmp $b } keys %payments) {