Ville Skyttä <[EMAIL PROTECTED]> writes:

> The current behaviour of LWP::RobotUA, when passed in an existing
> WWW::RobotRules::InCore object is counterintuitive to me.
> 
> I am of this opinion because of the documentation of $rules in
> LWP::RobotUA->new() and WWW::RobotRules->agent(), as well as the
> implementation in WWW::RobotRules::AnyDBM_File.
> 
> Currently, W::R::InCore empties the cache always when agent() is called,
> regardless if the agent name changed or not.  W::R::AnyDBM_File does not
> seem to have this problem.
> 
> I suggest applying the attached patch to fix this.

Applied.  Will be in 5.801.

Regards,
Gisle


> Index: lib/WWW/RobotRules.pm
> ===================================================================
> RCS file: /cvsroot/libwww-perl/lwp5/lib/WWW/RobotRules.pm,v
> retrieving revision 1.30
> diff -a -u -r1.30 RobotRules.pm
> --- lib/WWW/RobotRules.pm     9 Apr 2004 15:09:14 -0000       1.30
> +++ lib/WWW/RobotRules.pm     12 Oct 2004 06:39:34 -0000
> @@ -185,10 +185,12 @@
>          #       "FooBot/1.2"                                  => "FooBot"
>          #       "FooBot/1.2 [http://foobot.int; [EMAIL PROTECTED]" => 
> "FooBot"
>  
> -     delete $self->{'loc'};   # all old info is now stale
>       $name = $1 if $name =~ m/(\S+)/; # get first word
>       $name =~ s!/.*!!;  # get rid of version
> -     $self->{'ua'}=$name;
> +     unless ($old && $old eq $name) {
> +         delete $self->{'loc'}; # all old info is now stale
> +         $self->{'ua'} = $name;
> +     }
>      }
>      $old;
>  }

Reply via email to