{
$_=$contents;
return if !defined $_;
- die "Empty contents".&where() if !$_;
- tr/ \t\n/ \n/s;
- s/([\001\n]) | ([\002\n])/$1$2/g;
- s/\nstrana \.\.\. ([\d ,]+\002)/\003$1/g;
- die "Page marker not found somewhere in this month".&where() if (/\001[^\003]*\002/);
- tr/\002//d;
- $insert_tb_obsah->execute($year,$month,$month_last,substr($_,1)) or die "SQL insert failure: $!";
+ if (!$_) {
+ print("Empty contents".&where()."!\n");
+ }
+ else {
+ tr/ \t\n/ \n/s;
+ s/([\001\n]) | ([\002\n])/$1$2/g;
+ s/\nstrana \.\.\. ([\d ,]+\002)/\003$1/g;
+ die "Page marker not found somewhere in this month".&where() if (/\001[^\003]*\002/);
+ tr/\002//d;
+ $_=substr($_,1);
+ }
+ $insert_tb_obsah->execute($year,$month,$month_last,$_) or die "SQL insert failure: $!";
undef $year,$month;
undef $contents;
}