diff options
author | lookshe <lookshe@fumuga.com> | 2012-03-12 19:26:28 +0100 |
---|---|---|
committer | lookshe <lookshe@fumuga.com> | 2012-03-12 19:26:28 +0100 |
commit | ca0c3a4b662c72cbfeca8884cdc13ef4d448467c (patch) | |
tree | ee9e1ab8787fef824a40056993b2d218176b2532 | |
parent | 388ab8f432ff7e91671a0208863a620469bebcc3 (diff) |
print something if no information was found in article
-rw-r--r-- | wiki2.pl | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -38,6 +38,7 @@ while ($found < 5) { } } } +my $printed = 0; if (defined $result) { my @lines = split('\n', $result->text_basic()); my @newlines; @@ -97,6 +98,7 @@ if (defined $result) { if ($line =~ m/^\*\s?/) { last if ($ln == 3) && ($lst = 1); print "$line\n"; + $printed = 1; $ln++; } } else { @@ -106,6 +108,7 @@ if (defined $result) { $line =~ s/^(.*[\.!\?]) [^\.!\?]*$/$1 (...)/; } print "$line\n"; + $printed = 1; last; } } @@ -115,4 +118,6 @@ if (defined $result) { } } else { print "No matches with $query\n"; + $printed = 1; } +print "No information found in article for $query\n" if !$printed; |