eqlog2csv.pl untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 46 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 ## convert an EverQuest log file to a CSV (actually '|' separated) file
2  
3 use strict;
4 use warnings;
5  
6 use Games::EverQuest::LogLineParser;
7  
8 die "USAGE: perl eqlog2csv.pl <eqlog_file> [output_file]\n" unless @ARGV > 0;
9  
10 my ($eqlog_file, $output_file) = @ARGV;
11  
12 $output_file = defined $output_file ? $output_file : '-';
13  
14 open (my $eqlog_fh, $eqlog_file) || die "$eqlog_file: $!";
15 open (my $output_fh, ">$output_file") || die "$output_file: $!";
16  
17 my @headers = all_possible_keys();
18  
19 print $output_fh join('|', @headers), "\n";
20  
21 while (<$eqlog_fh>)
22 {
23  
24 my $line = parse_eq_line($_);
25  
26 if ($line)
27 {
28  
29 no warnings 'uninitialized';
30  
31 $_ =~ tr/|//d for values %{ $line };
32  
33 print $output_fh join('|', @{ $line }{ @headers }), "\n";
34  
35 }
36  
37 }
38  
39 close $eqlog_fh;
40 close $output_fh;
41  
42 __END__