]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
[leodict] change error handling and update s chec
authorbw1 <redacted>
Thu, 6 Jan 2022 16:24:38 +0000 (17:24 +0100)
committerGitHub <redacted>
Thu, 6 Jan 2022 16:24:38 +0000 (17:24 +0100)
scripts/leodict.pl

index f440cb38012f19400a3a0127ad4dc40b738c8ac7..8b1fd8a9541ca2cc33d06197a45a2381762a1684 100644 (file)
@@ -117,7 +117,10 @@ sub parser {
     %fresult=();
 
     # tables
-    return unless (defined $ftext); 
+    unless (defined $ftext) {
+       %fresult=('Error'=>[['no data']]);
+       return;
+    }
     my $dom = Mojo::DOM->new($ftext);
     foreach my $tbl ( $dom->find('table')->each ) {
 
@@ -401,8 +404,8 @@ sub self_check {
        $s="Error: results ($count)";
     }
     Irssi::print("selfcheck: $s");
-    my $schs_version = $Irssi::Script::selfcheckhelperscript::VERSION;
-    Irssi::command("selfcheckhelperscript $s") if ( defined $schs_version );
+    my $schs =  exists $Irssi::Script::{'selfcheckhelperscript::'};
+    Irssi::command("selfcheckhelperscript $s") if ( $schs );
 }
 
 sub sig_setup_changed {
git clone https://git.99rst.org/PROJECT