X-Git-Url: https://git.jankratochvil.net/?a=blobdiff_plain;f=obsah_init.pl;fp=obsah_init.pl;h=89d40a773da7974f7cd862738a2ea2097cd56c93;hb=75159a7002cbeb5754f9a8d9644add2ffb1c5bed;hp=5668855cfb90be3cc0821ec4c71e42a6ac9a86f7;hpb=31723f9621977f03379eeb2387c8cfd19888e115;p=www.energie.vellum.cz.git diff --git a/obsah_init.pl b/obsah_init.pl index 5668855..89d40a7 100755 --- a/obsah_init.pl +++ b/obsah_init.pl @@ -52,13 +52,18 @@ sub flush_month { $_=$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; }