6 # 2010-07-13 Dobrica Pavlinusic <dpavlin@rot13.org>
8 use Data::Dump qw/dump/;
13 my $dir = 'yaml/hrEduPersonUniqueNumber_JMBG';
15 mkdir $dir unless -e $dir;
17 my $path = shift @ARGV || die "usage: $0 file.csv\n";
19 my $csv = Text::CSV->new ( { binary => 1 } ) # should set binary attribute.
20 or die "Cannot use CSV: ".Text::CSV->error_diag ();
22 open my $fh, "<:encoding(utf8)", $path or die "$path: $!";
23 while ( my $row = $csv->getline( $fh ) ) {
25 my ( $ulica, $grad ) = split(/\s*,\s*/, $row->[8]);
31 datum_rodjenja => $row->[3],
33 adresa_ulica => $ulica,
35 tel_fixed => $row->[9],
36 tel_mobile => $row->[10],
37 spol => substr($row->[2],9,3) < 500 ? 'M' : 'F',
41 DumpFile( "$dir/$uuid.yaml", $info );
44 $csv->eof or $csv->error_diag();