Algorithm-Accounting

 view release on metacpan or  search on metacpan

lib/Algorithm/Accounting/Report/Text.pm  view on Meta::CPAN

  my $field_groups = shift;
  my $group_occurrence = shift;
  my @field = @{$field_groups->[$i]};
  my $occ  = $group_occurrence->[$i];
  my $rows = sum(values %$occ);
  local $, = ',';

  my $form_format = '|' . join('|',map {'{<<<<<<<<<<<<}'} @field) . '|{>>>>>>>>>>>>}|';
  my $sep = '+' . '=' x (15*(1+@field) - 1) . '+';
  print form $sep , $form_format, @field, "Percentage",$sep ;
  $form_format =~ s/>>}\|$/.}%|/;
  for(sort { (thaw($a))[0] cmp (thaw($b))[0] } keys %$occ) {
    my @fv = thaw($_);
    print form
      $form_format ,
      @fv, (100 * $occ->{$_} / $rows);
  }
  print form $sep;
  print form
    '|{' . '<' x (15*(1+@field) - 3) . '}|',
    "Total records: $rows",



( run in 1.275 second using v1.01-cache-2.11-cpan-df04353d9ac )