% my @prefixes = ('');
% if ( $old{same} ) {
% @prefixes = ('bill_');
% } elsif ( $old{billship} ) {
% @prefixes = ('bill_', 'ship_');
% }
% for my $pre (@prefixes) {
% my $name = $pre eq 'bill_' ? 'billing' : 'service';
% if ( $new{$pre.'error'} ) {
Entered <%$name%> address
% if ( $old{$pre.'company'} ) {
<% $old{$pre.'company'} %>
% }
<% $old{$pre.'address1'} %>
<% $new{$pre.'error'} %>
<% $old{$pre.'address2'} %>
<% $old{$pre.'city'} %>, <% $old{$pre.'state'} %> <% $old{$pre.'zip'} %>
% } else { # not an error
Entered <%$name%> address
Standardized <%$name%> address
% if ( !$new{$pre.'addr_clean'} ) {
(unverified)
% }
% if ( $old{$pre.'company'} ) {
<% $old{$pre.'company'} %>
<% $new{$pre.'company'} %>
% }
<% $old{$pre.'address1'} %>
<% $new{$pre.'address1'} %>
<% $old{$pre.'address2'} %>
<% $new{$pre.'address2'} %>
<% $old{$pre.'city'} %>, <% $old{$pre.'state'} %> <% $old{$pre.'zip'} %>
<% $new{$pre.'city'} %>, <% $new{$pre.'state'} %> <% $new{$pre.'zip'} %>
% } # if error
% } # for $pre
%# only do this part if address standardization provided a censustract
% my $pre = $old{same} ? 'bill_' : 'ship_';
% my $censustract = $new{$pre.'censustract'};
% my $census_error = $new{$pre.'census_error'};
% if ( $censustract ) {
Entered census tract
Calculated census tract
<% $old{$pre.'censustract'} %>
% if ( $census_error ) {
<% $census_error %>
% } else {
<% $censustract %>
% }
% } #if censustract
% if ( grep {$new{$_.'error'}} @prefixes ) {
Use entered <%$addresses%>
Cancel submission
% } else {
Use entered <%$addresses%>
Use standardized <%$addresses%>
Cancel submission
% } # !error
<%init>
# slightly weird interface...
my $q = decode_json($cgi->param('q'));
#warn Dumper($q);
my %old = %{ $q->{old} };
my %new = %{ $q->{new} };
my $addresses = $old{billship} ? 'addresses' : 'address';
%init>