33 |
|
|
34 |
my $path; # this is name of database |
my $path; # this is name of database |
35 |
|
|
36 |
Text::Iconv->raise_error(1); # Conversion errors raise exceptions |
Text::Iconv->raise_error(0); # Conversion errors don't raise exceptions |
37 |
|
|
38 |
# this is encoding of all files on disk, including import_xml/*.xml file and |
# this is encoding of all files on disk, including import_xml/*.xml file and |
39 |
# filter/*.pm files! It will be used to store strings in perl internally! |
# filter/*.pm files! It will be used to store strings in perl internally! |
247 |
sub progress { |
sub progress { |
248 |
#return if (! $opts{q}); # FIXME |
#return if (! $opts{q}); # FIXME |
249 |
my $current = shift; |
my $current = shift; |
250 |
my $total = shift; |
my $total = shift || 1; |
251 |
my $p = int($current * 100 / $total); |
my $p = int($current * 100 / $total); |
252 |
if ($p != $last_p) { |
if ($p != $last_p) { |
253 |
printf STDERR ("%5d / %5d [%-51s] %-2d %% \r",$current,$total,"=" x ($p/2).">", $p ); |
printf STDERR ("%5d / %5d [%-51s] %-2d %% \r",$current,$total,"=" x ($p/2).">", $p ); |
297 |
my $excel_file = $cfg -> val($database, 'excel_file') || die "$database doesn't have 'excel_file' defined!"; |
my $excel_file = $cfg -> val($database, 'excel_file') || die "$database doesn't have 'excel_file' defined!"; |
298 |
|
|
299 |
my $sheet = x($config->{sheet}) || die "no sheet in $type.xml"; |
my $sheet = x($config->{sheet}) || die "no sheet in $type.xml"; |
300 |
my $start_row = x($config->{start_row}) || die "no start_row in $type.xml"; |
my $start_row = x($config->{start_row}) - 1 || die "no start_row in $type.xml"; |
301 |
|
|
302 |
my $oBook = Spreadsheet::ParseExcel::Workbook->Parse($excel_file) || die "can't open Excel file '$excel_file'"; |
my $oBook = Spreadsheet::ParseExcel::Workbook->Parse($excel_file) || die "can't open Excel file '$excel_file'"; |
303 |
|
|
314 |
defined ($oWorksheet) || die "can't find sheet '$sheet' in $excel_file"; |
defined ($oWorksheet) || die "can't find sheet '$sheet' in $excel_file"; |
315 |
my $end_row = x($config->{end_row}) || $oWorksheet->{MaxRow}; |
my $end_row = x($config->{end_row}) || $oWorksheet->{MaxRow}; |
316 |
|
|
317 |
for(my $iR = $oWorksheet->{MinRow} ; defined $end_row && $iR <= $end_row ; $iR++) { |
for(my $iR = $start_row ; defined $end_row && $iR <= $end_row ; $iR++) { |
318 |
my $row; |
my $row; |
319 |
for(my $iC = $oWorksheet->{MinCol} ; defined $oWorksheet->{MaxCol} && $iC <= $oWorksheet->{MaxCol} ; $iC++) { |
for(my $iC = $oWorksheet->{MinCol} ; defined $oWorksheet->{MaxCol} && $iC <= $oWorksheet->{MaxCol} ; $iC++) { |
320 |
my $cell = $oWorksheet->{Cells}[$iR][$iC]; |
my $cell = $oWorksheet->{Cells}[$iR][$iC]; |