Skip Menu |

This queue is for tickets about the WWW-RobotRules CPAN distribution.

Report information
The Basics
Id: 23895
Status: open
Priority: 0/
Queue: WWW-RobotRules

People
Owner: Nobody in particular
Requestors: keyoshid [...] yahoo-corp.jp
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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>
On Mon Dec 11 21:26:40 2006, keyoshid wrote: Show quoted text
> 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> >
This patch should not be applied as it causes test failures to occur. The problem with the test code above is that it adds a version to the robot.txt's user agent string. This is the mistake that causes the failures to occur.