summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlookshe <lookshe@fumuga.com>2012-03-12 19:26:28 +0100
committerlookshe <lookshe@fumuga.com>2012-03-12 19:26:28 +0100
commitca0c3a4b662c72cbfeca8884cdc13ef4d448467c (patch)
treeee9e1ab8787fef824a40056993b2d218176b2532
parent388ab8f432ff7e91671a0208863a620469bebcc3 (diff)
print something if no information was found in article
-rw-r--r--wiki2.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/wiki2.pl b/wiki2.pl
index b91475a..d6b66bb 100644
--- a/wiki2.pl
+++ b/wiki2.pl
@@ -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;