Skip to content

Commit

Permalink
use comma (,) as separator for *.csv file is it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
dpavlin committed Apr 29, 2013
1 parent 4ea6847 commit 23a76f4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/MojoFacets/Import/CSV.pm
Expand Up @@ -46,6 +46,11 @@ sub data {
$sep_char = shift @sep_by_usage;
}

if ( $sep_char !~ m/,/ && $possible_delimiters->{','} && $path =~ m/\.csv/i ) {
$sep_char = ',';
warn "## csv file detected so prefer , as separator";
}

warn "sep_char = [$sep_char] for $path\n";

my $csv = Text::CSV->new ( { binary => 1, eol => $/, sep_char => $sep_char } )
Expand Down

0 comments on commit 23a76f4

Please sign in to comment.