NAME
HTTP::BrowserDetect::isRobot - test if the user-agent is a robot or not
VERSION
version 0.06
SYNOPSIS
use HTTP::BrowserDetect::isRobot 'is_robot';
if ( is_robot('Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)') ) {
print "Yes\n";
}
DESCRIPTION
extends HTTP::BrowserDetect with more robot detection.
inspired by Plack::Middleware::BotDetector
METHODS
is_robot
take User-Agent as the only argument. return 1 if yes.
== is_site_robot || is_program_robot
the regexp is quite incomplete. patches welcome.
is_site_robot
take User-Agent as the only argument. return 1 if yes.
check if it's from any website like Google or Bing.
use HTTP::BrowserDetect::isRobot 'is_site_robot';
if ( is_site_robot('Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)') ) {
print "Yes\n";
}
is_program_robot
take User-Agent as the only argument. return 1 if yes.
check if it's from any library of programming languages, like LWP or WWW::Mechanize or others.
use HTTP::BrowserDetect::isRobot 'is_program_robot';
if ( is_program_robot('libwww-perl/5.833') ) {
print "Yes\n";
}
AUTHOR
Fayland Lam <fayland@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Fayland Lam.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.