williamr/buglist_to_mediawiki.pl
changeset 244 2251fde91223
parent 239 d01a4084d621
child 245 478794dc0351
equal deleted inserted replaced
243:db98b6a443ad 244:2251fde91223
    14 # Description:
    14 # Description:
    15 # Convert tab-separated buglist into Mediawiki table
    15 # Convert tab-separated buglist into Mediawiki table
    16 
    16 
    17 use strict;
    17 use strict;
    18 
    18 
       
    19 use FindBin;
       
    20 use lib "$FindBin::Bin\\..\\lib";
       
    21 use Text::CSV;
       
    22 
       
    23 my $csv = Text::CSV->new();
       
    24 
    19 print "{|\n";   # start of table
    25 print "{|\n";   # start of table
    20 
    26 
    21 while (my $line = <>)
    27 while (my $line = <>)
    22   {
    28   {
    23   chomp $line;
    29   chomp $line;
    24   my @columns = split /\t/, $line;
    30   
       
    31   unless ($csv->parse($line))
       
    32   {
       
    33     my $err = $csv->error_input();
       
    34     warn "Failed to parse line '$line': $err\n";
       
    35     next;
       
    36   }
       
    37 
       
    38   my @columns = $csv->fields();
    25   
    39   
    26   next if scalar @columns < 2;    # skip dubious looking lines
    40   next if scalar @columns < 2;    # skip dubious looking lines
    27   
    41   
    28   if ($. == 1)
    42   if ($. == 1)
    29     {
    43     {