Robots::Validate - Validate that IP addresses are associated with known robots
version v0.2.3
use Robots::Validate; my $rv = Robots::Validate->new; ... if ( $rs->validate( $ip, \%opts ) ) { ... }
resolver
This is the Net::DNS::Resolver used for DNS lookups.
robots
This is an array reference of rules with information about robots. Each item is a hash reference with the following keys:
name
The name of the robot.
agent
A regular expression for matching against user agent names.
domain
A regular expression for matching against the hostname.
die_on_error
When true, "validate" will die on a "resolver" failure.
By default it is false.
validate
my $result = $rv->validate( $ip, \%opts );
This method attempts to validate that an IP address belongs to a known robot by first looking up the hostname that corresponds to the IP address, and then validating that the hostname resolves to that IP address.
If this succeeds, it then checks if the hostname is associated with a known web robot.
If that succeeds, it returns a copy of the matched rule from "robots".
You can specify the following %opts:
%opts
This is the user-agent string. If it does not match, then the DNS lookkups will not be performed.
It is optional.
Alternatively, you can pass in a Plack environment:
my $result = $rv->validate($env);
The current module can only be used for systems that consistently support reverse DNS lookups. This means that it cannot be used to validate some robots from Facebook or Twitter.
The development version is on github at https://github.com/robrwo/Robots-Validate and may be cloned from git://github.com/robrwo/Robots-Validate.git
Please report any bugs or feature requests on the bugtracker website https://github.com/robrwo/Robots-Validate/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Robert Rothenberg <rrwo@cpan.org>
This software is Copyright (c) 2018-2021 by Robert Rothenberg.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Robots::Validate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Robots::Validate
CPAN shell
perl -MCPAN -e shell install Robots::Validate
For more information on module installation, please visit the detailed CPAN module installation guide.