common/tools/populateziptemplate.pl
changeset 84 fcf94a72b33e
parent 76 a115d49b621f
child 88 28463bb10fde
equal deleted inserted replaced
83:add0abfa2371 84:fcf94a72b33e
     2 use warnings;
     2 use warnings;
     3 
     3 
     4 use Text::CSV;
     4 use Text::CSV;
     5 require XML::Simple;
     5 require XML::Simple;
     6 
     6 
     7 # Raw inputs (should probably come in as parameters to the script)
     7 # Raw inputs come in as parameters to the script
       
     8 # TODO: Use a proper option parsing module
     8 my $sourcesCSV = shift or die "First arg must be source csv file";
     9 my $sourcesCSV = shift or die "First arg must be source csv file";
     9 my $template = shift or die "Second arg must be template file";
    10 my $template = shift or die "Second arg must be template file";
    10 
    11 my $ftl = shift or die "Third arg must be output file";
    11 # Derived values
    12 shift and die "No more than three arguments please";
    12 my ($ftl) = $template =~ m{(.*)\.template$};
       
    13 #$ftl =~ m{[^/\\]+$};
       
    14 #$ftl = $1;
       
    15 
    13 
    16 # Load CSV
    14 # Load CSV
    17 open my $csvText, "<", $sourcesCSV or die;
    15 open my $csvText, "<", $sourcesCSV or die;
    18 my $csv = Text::CSV->new();
    16 my $csv = Text::CSV->new();
    19 my @keys;
    17 my @keys;