1 % $csv->combine(@$header); #or die $csv->status;
5 % foreach my $row ( @$rows ) {
7 % if ( $opt{'fields'} ) {
11 % foreach my $field ( @{$opt{'fields'}} ) {
12 % if ( ref($field) eq 'CODE' ) {
15 % ? '(N/A)' #unimplemented
20 % push @line, $row->$field();
24 % $csv->combine(@line); #or die $csv->status;
27 % $csv->combine(@$row); #or die $csv->status;
37 my $header = $args{'header'};
38 my $rows = $args{'rows'};
39 my %opt = %{ $args{'opt'} };
41 #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes
42 http_header('Content-Type' => 'text/plain' );
44 my $csv = new Text::CSV_XS { 'always_quote' => 1,
45 'eol' => "\n", #"\015\012", #"\012"