chiark / gitweb /
De-%ify a big chunk of perl
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 24 Aug 2009 14:37:03 +0000 (15:37 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 24 Aug 2009 14:37:03 +0000 (15:37 +0100)
yarrg/web/routetrade

index 12b4a89..e4e583a 100644 (file)
@@ -575,42 +575,44 @@ Start at <% $islandname |h %>
 Sail to <% $islandname |h %>
 %      }
 </strong>
-%    my $age_reported= 0;
-%    my %flowlists;
-%    foreach my $od (qw(org dst)) {
-%      foreach my $f (@flows) {
-%              next if $f->{Suppress};
-%              next unless $f->{"${od}_id"} == $islandids[$i];
-%              next unless $f->{OptQty};
-%              my $price= $f->{"${od}_price"};
-%              my $stallname= $f->{"${od}_stallname"};
-%              my $todo= \$flowlists{$od}{
-%                              $f->{'commodname'},
-%                              (sprintf "%07d", $price),
-%                              $stallname
-%                      };
-%              $$todo= {
-%                      Qty => 0,
-%                      orgArbitrage => 0,
-%                      dstArbitrage => 0,
-%              } unless $$todo;
-%              $$todo->{'commodname'}= $f->{'commodname'};
-%              $$todo->{'stallname'}= $stallname;
-%              $$todo->{Price}= $price;
-%              $$todo->{Timestamp}= $f->{"${od}_timestamp"};
-%              $$todo->{Qty} += $f->{OptQty};
-%              $$todo->{Total}= $$todo->{Price} * $$todo->{Qty};
-%              $$todo->{Stalls}= $f->{"${od}Stalls"};
-%              if ($f->{'org_id'} == $f->{'dst_id'}) {
-%                      $$todo->{"${od}Arbitrage"}= 1;
-%              }
-%      }
-%    }
-%
-%    my $total;
-%    my $dline= 0;
-%    my $show_flows= sub {
-%      my ($od,$arbitrage,$collectdeliver) = @_;
+<%perl>
+     my $age_reported= 0;
+     my %flowlists;
+     foreach my $od (qw(org dst)) {
+       foreach my $f (@flows) {
+               next if $f->{Suppress};
+               next unless $f->{"${od}_id"} == $islandids[$i];
+               next unless $f->{OptQty};
+               my $price= $f->{"${od}_price"};
+               my $stallname= $f->{"${od}_stallname"};
+               my $todo= \$flowlists{$od}{
+                               $f->{'commodname'},
+                               (sprintf "%07d", $price),
+                               $stallname
+                       };
+               $$todo= {
+                       Qty => 0,
+                       orgArbitrage => 0,
+                       dstArbitrage => 0,
+               } unless $$todo;
+               $$todo->{'commodname'}= $f->{'commodname'};
+               $$todo->{'stallname'}= $stallname;
+               $$todo->{Price}= $price;
+               $$todo->{Timestamp}= $f->{"${od}_timestamp"};
+               $$todo->{Qty} += $f->{OptQty};
+               $$todo->{Total}= $$todo->{Price} * $$todo->{Qty};
+               $$todo->{Stalls}= $f->{"${od}Stalls"};
+               if ($f->{'org_id'} == $f->{'dst_id'}) {
+                       $$todo->{"${od}Arbitrage"}= 1;
+               }
+       }
+     }
+
+     my $total;
+     my $dline= 0;
+     my $show_flows= sub {
+       my ($od,$arbitrage,$collectdeliver) = @_;
+</%perl>
 %
 %      my $todo= $flowlists{$od};
 %      return unless $todo;
@@ -663,14 +665,16 @@ Sail to <% $islandname |h %>
 %      }
 %      $total= undef;
 %      $dline= 0;
-%    };
-%
-%    $show_flows->('org',1,'Collect');  $show_total->('(Arbitrage) outlay');
-%    $show_flows->('dst',1,'Deliver');
-%    $show_flows->('dst',0,'Deliver');  $show_total->('Proceeds');
-%    $show_flows->('org',0,'Collect');  $show_total->('Outlay');
-%
-% }
+<%perl>
+     };
+
+     $show_flows->('org',1,'Collect');  $show_total->('(Arbitrage) outlay');
+     $show_flows->('dst',1,'Deliver');
+     $show_flows->('dst',0,'Deliver');  $show_total->('Proceeds');
+     $show_flows->('org',0,'Collect');  $show_total->('Outlay');
+
+}
+</%perl>
 </table>
 <& query_age:dataages, id2age => \%da_ages &>
 %