Subject: | Bug in WWW::RobotRules |
Hello
I found a bug in WWW::RobotRules, so report it.
Distribution: WWW::RobotRules 1.33
Perl: v5.8.5
<sampleCode>
use strict;
use WWW::RobotRules;
my $robotsContent = <<"EOT";
User-agent: Test/1.0
Disallow: /
EOT
my $useUserAgent = "Test/1.0";
my $robotRules = WWW::RobotRules->new($useUserAgent);
$robotRules->parse("http://test/robots.txt", $robotsContent);
if ($robotRules->allowed("http://test/")) {
print "[ALLOW]\n";
} else {
print "[DENY]\n";
}
</sampleCode>
I think printing "[DENY]" is correct result,
but print "[ALLOW]" in WWW::RobotRules 1.33.
<Patch>
diff: conflicting specifications of output style
--- RobotRules.pm~ Fri Dec 8 20:26:59 2006
+++ RobotRules.pm Fri Dec 8 20:27:18 2006
@@ -132,7 +132,8 @@
# See whether my short-name is a substring of the
# "User-Agent: ..." line that we were passed:
- if(index(lc($me), lc($ua_line)) >= 0) {
+# if(index(lc($me), lc($ua_line)) >= 0) {
+ if(index(lc($ua_line), lc($me)) >= 0) {
LWP::Debug::debug("\"$ua_line\" applies to \"$me\"")
if defined &LWP::Debug::debug;
return 1;
</Patch>