oalders/http-browserdetect

robot() returns 0 instead of undef in this program

nigelhorne opened this issue · 6 comments

#!/usr/bin/env perl

use strict;
use warnings;
use HTTP::BrowserDetect;

print HTTP::BrowserDetect->new('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.7; en-US; rv:1.9.2.20) Gecko/20110803 Firefox/3.6.20')->robot(), "\n";

Thanks for this. The documentation should be changed to say that it returns false instead of undef. https://metacpan.org/source/OALDERS/HTTP-BrowserDetect-2.07/lib/HTTP/BrowserDetect.pm#L374

Hm, how do you feel about changing the code to match the docs instead? The only reason robot() returns 0 in that case is because I guess it evolved out of being a test into being something akin to os() or browser(). Making robot() return undef if there's no robot identified makes it consistent with everything similar (it makes it behave the same as os(), browser(), and so on).

👍

Awesome, I implemented this and a couple other robot-related fixes. I've been closing issues if it's seems like they're fixed; I assume you're in favor of that. :-)

I don't really mind, I can change my caller easily.

I've been closing issues if it's seems like they're fixed; I assume you're in favor of that. :-)

No complaints! ;)