#!/usr/bin/perl -w

use strict;
use DBI;
use Data::Dump qw/dump/;
use Algorithm::CheckDigits;
use Text::Unaccent;

use lib 'lib';
use FERWeb;

my $f = FERWeb->new;
my $c = DBI->connect("dbi:CSV:","","", { RaiseError => 1, f_ext => '.csv', f_encoding => 'utf-8' }) || die $dbi::errstr;

my $s = $c->prepare(qq{
select * from brucosi_2011_ISVU
});
$s->execute;

while( my $row = $s->fetchrow_hashref ) {

	warn "# row = ",dump($row),$/;

	my $user = $f->getinfobycode( $row->{jmbag} );

	warn "# user = ", dump($user), $/;

	print join(" "
		, $row->{jmbag}
		, $user->{nick}
		, $user->{email}
	),$/;
}
