From 3485f0b847442e2c974185011f5b9b9db2284eca Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Tue, 1 Nov 2011 12:28:01 -0400 Subject: [PATCH] Fixed formatting and added sanity check code. --- fund-report.plx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fund-report.plx b/fund-report.plx index 35463fe..9d6a31b 100755 --- a/fund-report.plx +++ b/fund-report.plx @@ -114,9 +114,15 @@ foreach my $fund (sort keys %funds) { print "Fund: $fund\n"; print " Balance as of $startDate: ", sprintf("\$%11.2f\n\n", $funds{$fund}{starting}); print " Income during period: ", sprintf("\$%11.2f\n", $funds{$fund}{Income}); - print " Expenses during period: ", sprintf("\$%11.2f\n", $funds{$fund}{Expenses}); + print " Expenses during period: ", sprintf("\$%11.2f\n\n", $funds{$fund}{Expenses}); print " Balance as of $endDate: ", sprintf("\$%11.2f\n", $funds{$fund}{ending}); print "\n\n"; + # Santity check: + if ($funds{$fund}{ending} == + ($funds{$fund}{starting} + $funds{$fund}{Income} + $funds{$fund}{Expenses})) { + print "$fund FAILED SANITY CHECK\n\n\n"; + die "$fund FAILED SANITY CHECK"; + } } ############################################################################### #