/usr/share/perl5/HTTP/BrowserDetect.pm is in libhttp-browserdetect-perl 1.68-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 | use strict;
use warnings;
package HTTP::BrowserDetect;
$HTTP::BrowserDetect::VERSION = '1.68';
use vars qw(@ALL_TESTS);
# Operating Systems
our @OS_TESTS = qw(
windows mac os2
unix linux vms
bsd amiga firefoxos
rimtabletos
);
# More precise Windows
our @WINDOWS_TESTS = qw(
win16 win3x win31
win95 win98 winnt
winme win32 win2k
winxp win2k3 winvista
win7 win8 win8_0
win8_1 wince winphone
winphone7 winphone7_5 winphone8
);
# More precise Mac
our @MAC_TESTS = qw(
macosx mac68k macppc
ios
);
# More precise Unix
our @UNIX_TESTS = qw(
sun sun4 sun5
suni86 irix irix5
irix6 hpux hpux9
hpux10 aix aix1
aix2 aix3 aix4
sco unixware mpras
reliant dec sinix
);
# More precise BSDs
our @BSD_TESTS = qw(
freebsd
);
# Gaming devices
our @GAMING_TESTS = qw(
ps3gameos pspgameos
);
# Devices
our %DEVICE_TESTS = (
android => 'Android',
audrey => 'Audrey',
blackberry => 'BlackBerry',
dsi => 'Nintendo DSi',
iopener => 'iopener',
ipad => 'iPad',
iphone => 'iPhone',
ipod => 'iPod',
kindle => 'Amazon Kindle',
n3ds => 'Nintendo 3DS',
palm => 'Palm',
ps3 => 'Sony PlayStation 3',
psp => 'Sony PlayStation Portable',
wap => 'WAP capable phone',
webos => 'webOS',
);
# Browsers
our @BROWSER_TESTS = qw(
mosaic netscape firefox
chrome safari ie
opera lynx links
elinks neoplanet neoplanet2
avantgo emacs mozilla
konqueror r1 netfront
mobile_safari obigo
);
our @IE_TESTS = qw(
ie3 ie4 ie4up
ie5 ie5up ie55
ie55up ie6 ie7
ie8 ie9 ie10
ie11
ie_compat_mode
);
our @OPERA_TESTS = qw(
opera3 opera4 opera5
opera6 opera7
);
our @AOL_TESTS = qw(
aol aol3 aol4
aol5 aol6
);
our @NETSCAPE_TESTS = qw(
nav2 nav3 nav4
nav4up nav45 nav45up
nav6 nav6up navgold
);
# Firefox variants
our @FIREFOX_TESTS = qw(
firebird iceweasel phoenix
namoroka
);
our @ENGINE_TESTS = qw(
gecko trident
);
# https://support.google.com/webmasters/answer/1061943?hl=en
my %ROBOTS = (
ahrefs => 'Ahrefs',
altavista => 'AltaVista',
askjeeves => 'AskJeeves',
baidu => 'Baidu Spider',
curl => 'curl',
facebook => 'Facebook',
getright => 'GetRight',
google => 'Google',
googleadsbot => 'Google AdsBot',
googleadsense => 'Google AdSense',
googlebotimage => 'Googlebot Images',
googlebotnews => 'Googlebot News',
googlebotvideo => 'Googlebot Video',
googlemobile => 'Google Mobile',
icab => 'iCab',
infoseek => 'InfoSeek',
linkchecker => 'LinkChecker',
linkexchange => 'LinkExchange',
lotusnotes => 'Lotus Notes',
lwp => 'LWP::UserAgent',
lycos => 'Lycos',
msn => 'MSN',
msnmobile => 'MSN Mobile',
puf => 'puf',
robot => 'robot',
slurp => 'Yahoo! Slurp',
specialarchiver => 'archive.org_bot',
staroffice => 'StarOffice',
webcrawler => 'WebCrawler',
webtv => 'WebTV',
wget => 'wget',
yahoo => 'Yahoo',
yandex => 'Yandex',
yandeximages => 'YandexImages',
);
our @ROBOT_TESTS = qw(
puf curl wget
getright robot slurp
yahoo
altavista lycos infoseek
lwp webcrawler linkexchange
webtv staroffice
lotusnotes icab googlemobile
msn msnmobile
facebook baidu googleadsbot
askjeeves googleadsense googlebotvideo
googlebotnews googlebotimage google
linkchecker yandeximages specialarchiver
yandex ahrefs
);
our @MISC_TESTS = qw(
mobile dotnet x11
java tablet
);
push @ALL_TESTS,
(
@OS_TESTS, @WINDOWS_TESTS,
@MAC_TESTS, @UNIX_TESTS,
@BSD_TESTS, @GAMING_TESTS,
( sort ( keys %DEVICE_TESTS ) ), @BROWSER_TESTS,
@IE_TESTS, @OPERA_TESTS,
@AOL_TESTS, @NETSCAPE_TESTS,
@FIREFOX_TESTS, @ENGINE_TESTS,
@ROBOT_TESTS, @MISC_TESTS,
);
# Safari build -> version map for versions prior to 3.0
# (since then, version appears in the user-agent string)
my %safari_build_to_version = qw(
48 0.8
51 0.8.1
60 0.8.2
73 0.9
74 1.0b2v74
85 1.0
85.7 1.0.2
85.8 1.0.3
100 1.1
100.1 1.1.1
125 1.2
125.1 1.2.1
125.7 1.2.2
125.9 1.2.3
125.11 1.2.4
312 1.3
312.3 1.3.1
312.5 1.3.2
412 2.0
412.5 2.0.1
416.12 2.0.2
417.8 2.0.3
419.3 2.0.4
);
#######################################################################################################
# BROWSER OBJECT
my $default = undef;
sub new {
my ( $class, $user_agent ) = @_;
my $self = {};
bless $self, $class;
unless ( defined $user_agent ) {
$user_agent = $ENV{'HTTP_USER_AGENT'};
}
$self->user_agent( $user_agent );
return $self;
}
foreach my $test ( @ALL_TESTS ) {
no strict 'refs';
my $key = uc $test;
*{$test} = sub {
my ( $self ) = _self_or_default( @_ );
return $self->{tests}->{$key};
};
}
sub _self_or_default {
my ( $self ) = $_[0];
return @_
if ( defined $self
&& ref $self
&& ( ref $self eq 'HTTP::BrowserDetect' )
|| UNIVERSAL::isa( $self, 'HTTP::BrowserDetect' ) );
$default ||= HTTP::BrowserDetect->new();
unshift( @_, $default );
return @_;
}
sub user_agent {
my ( $self, $user_agent ) = _self_or_default( @_ );
if ( defined $user_agent ) {
$self->{user_agent} = $user_agent;
$self->_test();
}
return $self->{user_agent};
}
# Private method -- test the UA string
sub _test {
my ( $self ) = @_;
$self->{tests} = {};
my $tests = $self->{tests};
$self->_os_tests;
$self->_robot_tests;
my @ff = ( 'firefox', @FIREFOX_TESTS );
my $ff = join "|", @ff;
my $ua = lc $self->{user_agent};
# Trident Engine (detect early for sniffing out IE)
$tests->{TRIDENT} = ( index( $ua, "trident/" ) != -1 );
if ( $tests->{TRIDENT} && $ua =~ /trident\/([\w\.\d]*)/ ) {
$self->{engine_version} = $1;
}
# Browser version
my ( $major, $minor, $beta ) = (
$ua =~ m{
\S+ # Greedly catch anything leading up to forward slash.
\/ # Version starts with a slash
[A-Za-z]* # Eat any letters before the major version
( [0-9A-Za-z]* ) # Major version number is everything before the first dot
\. # The first dot
( [\d]* ) # Minor version number is every digit after the first dot
[\d.]* # Throw away remaining numbers and dots
( [^\s]* ) # Beta version string is up to next space
}x
);
# Firefox version
if ($ua =~ m{
($ff)
\/
( [^.]* ) # Major version number is everything before first dot
\. # The first dot
( [\d]* ) # Minor version nnumber is digits after first dot
}xo
)
{
$major = $2;
$minor = $3;
$tests->{ uc( $1 ) } = 1;
$tests->{'FIREFOX'} = 1;
}
# IE (and others) version
if ( $ua =~ m{\b msie \s ( [0-9\.]+ ) (?: [a-z]+ [a-z0-9]* )? ;}x ) {
# Internet Explorer
( $major, $minor, $beta ) = split /\./, $1;
}
elsif ( $ua
=~ m{\b compatible; \s* [\w\-]* / ( [0-9\.]* ) (?: [a-z]+ [a-z0-9\.]* )? ;}x
)
{
# Generic "compatible" formats
( $major, $minor, $beta ) = split /\./, $1;
}
elsif ($tests->{TRIDENT} && $ua =~ m{\b rv: ( [0-9\.]+ ) \b}x ) {
# MSIE masking as Gecko really well ;)
( $major, $minor, $beta ) = split /\./, $1;
}
# Opera browsers
$tests->{OPERA}
= ( index( $ua, "opera" ) != -1
|| index( $ua, "opr/" ) != -1 );
$tests->{OPERA3}
= ( index( $ua, "opera 3" ) != -1
|| index( $ua, "opera/3" ) != -1 );
$tests->{OPERA4}
= ( index( $ua, "opera 4" ) != -1 )
|| ( index( $ua, "opera/4" ) != -1
&& ( index( $ua, "nintendo dsi" ) == -1 ) );
$tests->{OPERA5}
= ( index( $ua, "opera 5" ) != -1 )
|| ( index( $ua, "opera/5" ) != -1 );
$tests->{OPERA6}
= ( index( $ua, "opera 6" ) != -1 )
|| ( index( $ua, "opera/6" ) != -1 );
$tests->{OPERA7}
= ( index( $ua, "opera 7" ) != -1 )
|| ( index( $ua, "opera/7" ) != -1 );
# Opera needs to be dealt with specifically
# http://dev.opera.com/articles/view/opera-ua-string-changes/
# http://my.opera.com/community/openweb/idopera/
# Opera/9.80 (S60; SymbOS; Opera Mobi/320; U; sv) Presto/2.4.15 Version/10.00
# Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.100
if ( $ua =~ m{\AOpera.*\sVersion/(\d*)\.(\d*)\z}i ) {
$major = $1;
$minor = $2;
}
elsif ( $ua =~ m{\bOPR/(\d+)\.(\d+)}i ) {
$major = $1;
$minor = $2;
}
elsif ( $ua =~ m{NetFront/(\d*)\.(\d*) Kindle}i ) {
$major = $1;
$minor = $2;
}
elsif ( $ua =~ m{Nintendo 3DS;.*\sVersion/(\d*)\.(\d*)}i ) {
$major = $1;
$minor = $2;
}
$major = 0 if !$major;
$minor = $self->_format_minor( $minor );
# Mozilla browsers
$tests->{GECKO} = ( index( $ua, "gecko" ) != -1 )
&& ( index( $ua, "like gecko" ) == -1 );
$tests->{CHROME}
= ( !$tests->{OPERA}
&& index( $ua, "chrome/" ) != -1 );
$tests->{SAFARI}
= ( ( index( $ua, "safari" ) != -1 )
|| ( index( $ua, "applewebkit" ) != -1 ) )
&& ( index( $ua, "chrome" ) == -1 );
$tests->{MOBILE_SAFARI}
= ( $tests->{SAFARI} && index( $ua, " mobile safari/" ) >= 0 );
# Chrome Version
if ( $tests->{CHROME} ) {
( $major, $minor ) = (
$ua =~ m{
chrome
\/
( [^.]* ) # Major version number is everything before first dot
\. # The first dot
( [^.]* ) # Minor version number is digits after first dot
}x
);
}
# Safari Version
elsif ( $tests->{SAFARI} ) {
my ( $safari_build, $safari_minor ) = (
$ua =~ m{
safari/
( \d+ ) # Major version number
( \. \d+ )? # Minor version number is dot and following digits
}x
);
if ( !$safari_build && $ua =~ m{applewebkit\/([\d\.]{1,})}xi ) {
# ignore digits after 2nd dot
( $safari_build, $safari_minor ) = split /\./, $1;
}
if ( $safari_build ) {
$major = int( $safari_build / 100 );
$minor = int( $safari_build % 100 ) / 100;
$beta = $safari_minor;
}
}
# Gecko-powered Netscape (i.e. Mozilla) versions
$tests->{NETSCAPE}
= ( !$tests->{FIREFOX}
&& !$tests->{SAFARI}
&& !$tests->{CHROME}
&& !$tests->{OPERA}
&& !$tests->{TRIDENT}
&& index( $ua, "mozilla" ) != -1
&& index( $ua, "msie" ) == -1
&& index( $ua, "spoofer" ) == -1
&& index( $ua, "compatible" ) == -1
&& index( $ua, "webtv" ) == -1
&& index( $ua, "hotjava" ) == -1
&& index( $ua, "nintendo" ) == -1
&& index( $ua, "playstation 3" ) == -1
&& index( $ua, "playstation portable" ) == -1 );
if ( $tests->{GECKO}
&& $tests->{NETSCAPE}
&& index( $ua, "netscape" ) != -1 )
{
( $major, $minor, $beta ) = (
$ua =~ m{
netscape6?\/
( [^.]* ) # Major version number is everything before first dot
\. # The first dot
( [\d]* ) # Minor version nnumber is digits after first dot
( [^\s]* )
}x
);
$minor = 0 + ".$minor";
}
# Netscape browsers
$tests->{NAV2} = ( $tests->{NETSCAPE} && $major == 2 );
$tests->{NAV3} = ( $tests->{NETSCAPE} && $major == 3 );
$tests->{NAV4} = ( $tests->{NETSCAPE} && $major == 4 );
$tests->{NAV4UP} = ( $tests->{NETSCAPE} && $major >= 4 );
$tests->{NAV45} = ( $tests->{NETSCAPE} && $major == 4 && $minor == .5 );
$tests->{NAV45UP} = ( $tests->{NAV4} && $minor >= .5 )
|| ( $tests->{NETSCAPE} && $major >= 5 );
$tests->{NAVGOLD} = ( defined( $beta ) && index( $beta, "gold" ) != -1 );
$tests->{NAV6} = ( $tests->{NETSCAPE} && ( $major == 5 || $major == 6 ) )
; # go figure
$tests->{NAV6UP} = ( $tests->{NETSCAPE} && $major >= 5 );
$tests->{MOZILLA} = ( $tests->{NETSCAPE} && $tests->{GECKO} );
# Internet Explorer browsers
$tests->{IE} = ( $tests->{TRIDENT}
|| index( $ua, "msie" ) != -1
|| index( $ua, 'microsoft internet explorer' ) != -1 );
$tests->{IE3} = ( $tests->{IE} && $major == 3 );
$tests->{IE4} = ( $tests->{IE} && $major == 4 );
$tests->{IE4UP} = ( $tests->{IE} && $major >= 4 );
$tests->{IE5} = ( $tests->{IE} && $major == 5 );
$tests->{IE5UP} = ( $tests->{IE} && $major >= 5 );
$tests->{IE55} = ( $tests->{IE} && $major == 5 && $minor >= .5 );
$tests->{IE55UP} = ( $tests->{IE5} && $minor >= .5 )
|| ( $tests->{IE} && $major >= 6 );
$tests->{IE6} = ( $tests->{IE} && $major == 6 );
$tests->{IE7} = ( $tests->{IE} && $major == 7 );
$tests->{IE8} = ( $tests->{IE} && $major == 8 );
$tests->{IE9} = ( $tests->{IE} && $major == 9 );
$tests->{IE10} = ( $tests->{IE} && $major == 10 );
$tests->{IE11} = ( $tests->{IE} && $major == 11 );
$tests->{IE_COMPAT_MODE}
= ( $tests->{IE7}
&& $tests->{TRIDENT}
&& $self->{engine_version} + 0 >= 4 );
# Neoplanet browsers
$tests->{NEOPLANET} = ( index( $ua, "neoplanet" ) != -1 );
$tests->{NEOPLANET2}
= ( $tests->{NEOPLANET} && index( $ua, "2." ) != -1 );
# AOL Browsers
$tests->{AOL} = ( index( $ua, "aol" ) != -1 );
$tests->{AOL3} = ( index( $ua, "aol 3.0" ) != -1 )
|| ( $tests->{AOL} && $tests->{IE3} );
$tests->{AOL4} = ( index( $ua, "aol 4.0" ) != -1 )
|| ( $tests->{AOL} && $tests->{IE4} );
$tests->{AOL5} = ( index( $ua, "aol 5.0" ) != -1 );
$tests->{AOL6} = ( index( $ua, "aol 6.0" ) != -1 );
$tests->{AOLTV} = ( index( $ua, "navio" ) != -1 )
|| ( index( $ua, "navio_aoltv" ) != -1 );
# Other browsers
$tests->{STAROFFICE} = ( index( $ua, "staroffice" ) != -1 );
$tests->{ICAB} = ( index( $ua, "icab" ) != -1 );
$tests->{LOTUSNOTES} = ( index( $ua, "lotus-notes" ) != -1 );
$tests->{KONQUEROR} = ( index( $ua, "konqueror" ) != -1 );
$tests->{LYNX} = ( index( $ua, "lynx" ) != -1 );
$tests->{LINKS} = ( index( $ua, "links" ) != -1 );
$tests->{ELINKS} = ( index( $ua, "elinks" ) != -1 );
$tests->{WEBTV} = ( index( $ua, "webtv" ) != -1 );
$tests->{MOSAIC} = ( index( $ua, "mosaic" ) != -1 );
$tests->{JAVA}
= ( index( $ua, "java" ) != -1
|| index( $ua, "jdk" ) != -1
|| index( $ua, "jakarta commons-httpclient" ) != -1 );
$tests->{NETFRONT}
= ( index( $ua, "playstation 3" ) != -1
|| index( $ua, "playstation portable" ) != -1
|| index( $ua, "netfront" ) != -1 );
# Devices
$tests->{BLACKBERRY} = ( index( $ua, "blackberry" ) != -1
|| index( $ua, "rim tablet os" ) != -1 );
$tests->{IPHONE} = ( index( $ua, "iphone" ) != -1 );
$tests->{WINCE} = ( index( $ua, "windows ce" ) != -1 );
$tests->{WINPHONE} = ( index( $ua, "windows phone" ) != -1 );
$tests->{WEBOS} = ( index( $ua, "webos" ) != -1 );
$tests->{IPOD} = ( index( $ua, "ipod" ) != -1 );
$tests->{IPAD} = ( index( $ua, "ipad" ) != -1 );
$tests->{KINDLE} = ( index( $ua, "kindle" ) != -1 );
$tests->{AUDREY} = ( index( $ua, "audrey" ) != -1 );
$tests->{IOPENER} = ( index( $ua, "i-opener" ) != -1 );
$tests->{AVANTGO} = ( index( $ua, "avantgo" ) != -1 );
$tests->{PALM} = ( $tests->{AVANTGO} || index( $ua, "palmos" ) != -1 );
$tests->{OBIGO} = ( index( $ua, "obigo/" ) != -1 );
$tests->{WAP}
= ( $tests->{OBIGO}
|| index( $ua, "up.browser" ) != -1
|| ( index( $ua, "nokia" ) != -1 && !$tests->{WINPHONE} )
|| index( $ua, "alcatel" ) != -1
|| index( $ua, "ericsson" ) != -1
|| index( $ua, "sie-" ) == 0
|| index( $ua, "wmlib" ) != -1
|| index( $ua, " wap" ) != -1
|| index( $ua, "wap " ) != -1
|| index( $ua, "wap/" ) != -1
|| index( $ua, "-wap" ) != -1
|| index( $ua, "wap-" ) != -1
|| index( $ua, "wap" ) == 0
|| index( $ua, "wapper" ) != -1
|| index( $ua, "zetor" ) != -1 );
$tests->{PS3} = ( index( $ua, "playstation 3" ) != -1 );
$tests->{PSP} = ( index( $ua, "playstation portable" ) != -1 );
$tests->{DSI} = ( index( $ua, "nintendo dsi" ) != -1 );
$tests->{'N3DS'} = ( index( $ua, "nintendo 3ds" ) != -1 );
$tests->{MOBILE} = (
( $tests->{FIREFOX} && index( $ua, "mobile" ) != -1 )
|| ( $tests->{IE}
&& !$tests->{WINPHONE}
&& index( $ua, "arm" ) != -1 )
|| index( $ua, "up.browser" ) != -1
|| index( $ua, "nokia" ) != -1
|| index( $ua, "alcatel" ) != -1
|| index( $ua, "ericsson" ) != -1
|| index( $ua, "sie-" ) == 0
|| index( $ua, "wmlib" ) != -1
|| index( $ua, " wap" ) != -1
|| index( $ua, "wap " ) != -1
|| index( $ua, "wap/" ) != -1
|| index( $ua, "-wap" ) != -1
|| index( $ua, "wap-" ) != -1
|| index( $ua, "wap" ) == 0
|| index( $ua, "wapper" ) != -1
|| index( $ua, "blackberry" ) != -1
|| index( $ua, "iemobile" ) != -1
|| index( $ua, "palm" ) != -1
|| index( $ua, "smartphone" ) != -1
|| index( $ua, "windows ce" ) != -1
|| index( $ua, "palmsource" ) != -1
|| index( $ua, "iphone" ) != -1
|| index( $ua, "ipod" ) != -1
|| index( $ua, "ipad" ) != -1
|| ( index( $ua, "opera mini" ) != -1
&& index( $ua, "tablet" ) == -1 )
|| ( index( $ua, "android" ) != -1
&& index( $ua, "mobile" ) != -1 )
|| index( $ua, "htc_" ) != -1
|| index( $ua, "symbian" ) != -1
|| index( $ua, "webos" ) != -1
|| index( $ua, "samsung" ) != -1
|| index( $ua, "samsung" ) != -1
|| index( $ua, "zetor" ) != -1
|| index( $ua, "android" ) != -1
|| index( $ua, "symbos" ) != -1
|| index( $ua, "opera mobi" ) != -1
|| index( $ua, "fennec" ) != -1
|| index( $ua, "opera tablet" ) != -1
|| index( $ua, "rim tablet" ) != -1
|| $tests->{PSP}
|| $tests->{DSI}
|| $tests->{'N3DS'}
|| $tests->{GOOGLEMOBILE}
|| $tests->{MSNMOBILE}
);
$tests->{TABLET} = (
index( $ua, "ipad" ) != -1
|| ( $tests->{IE}
&& !$tests->{WINPHONE}
&& index( $ua, "arm" ) != -1 )
|| ( index( $ua, "android" ) != -1
&& index( $ua, "mobile" ) == -1
&& index( $ua, "opera" ) == -1 )
|| ($tests->{FIREFOX} && index( $ua, "tablet" ) != -1)
|| index( $ua, "kindle" ) != -1
|| index( $ua, "xoom" ) != -1
|| index( $ua, "flyer" ) != -1
|| index( $ua, "jetstream" ) != -1
|| index( $ua, "transformer" ) != -1
|| index( $ua, "novo7" ) != -1
|| index( $ua, "an10g2" ) != -1
|| index( $ua, "an7bg3" ) != -1
|| index( $ua, "an7fg3" ) != -1
|| index( $ua, "an8g3" ) != -1
|| index( $ua, "an8cg3" ) != -1
|| index( $ua, "an7g3" ) != -1
|| index( $ua, "an9g3" ) != -1
|| index( $ua, "an7dg3" ) != -1
|| index( $ua, "an7dg3st" ) != -1
|| index( $ua, "an7dg3childpad" ) != -1
|| index( $ua, "an10bg3" ) != -1
|| index( $ua, "an10bg3dt" ) != -1
|| index( $ua, "opera tablet" ) != -1
|| index( $ua, "rim tablet" ) != -1
|| index( $ua, "hp-tablet" )
!= -1
);
# Operating System
# A final try at browser version, if we haven't gotten it so far
if ( !defined( $major ) || $major eq '' ) {
if ( $ua =~ /[A-Za-z]+\/(\d+)\;/ ) {
$major = $1;
$minor = 0;
}
}
# Gecko version
$self->{gecko_version} = undef;
if ( $tests->{GECKO} ) {
if ( $ua =~ /\([^)]*rv:([\w.\d]*)/ ) {
$self->{gecko_version} = $1;
$self->{engine_version} = $1;
}
}
# RealPlayer
$tests->{REALPLAYER}
= ( index( $ua, "(r1 " ) != -1 || index( $ua, "realplayer" ) != -1 );
$self->{realplayer_version} = undef;
if ( $tests->{REALPLAYER} ) {
if ( $ua =~ /realplayer\/([\d+\.]+)/ ) {
$self->{realplayer_version} = $1;
my @version = split( /\./, $self->{realplayer_version} );
$major = shift @version;
$minor = shift @version;
}
elsif ( $ua =~ /realplayer\s(\w+)/ ) {
$self->{realplayer_version} = $1;
}
}
# Device from UA
$self->{device_name} = undef;
if ( $tests->{OBIGO} && $ua =~ /^(mot-\S+)/ ) {
$self->{device_name} = substr $self->{user_agent}, 0, length $1;
$self->{device_name} =~ s/^MOT-/Motorola /i;
}
elsif (
$ua =~ /windows phone os [^\)]+ iemobile\/[^;]+; ([^;]+; [^;\)]+)/g )
{
$self->{device_name} = substr $self->{user_agent},
pos( $ua ) - length $1, length $1;
$self->{device_name} =~ s/; / /;
}
elsif ( $ua
=~ /windows phone [^\)]+ iemobile\/[^;]+; arm; touch; ([^;]+; [^;\)]+)/g
)
{
$self->{device_name} = substr $self->{user_agent},
pos( $ua ) - length $1, length $1;
$self->{device_name} =~ s/; / /;
}
$self->{major} = $major;
$self->{minor} = $minor;
$self->{beta} = $beta;
$self->_os_tests;
$self->_robot_tests;
return undef unless $self->robot;
}
sub _robot_tests {
my $self = shift;
my $ua = lc $self->{user_agent};
my $tests = $self->{tests};
$tests->{LWP}
= ( index( $ua, "libwww-perl" ) != -1 || index( $ua, "lwp-" ) != -1 );
$tests->{YAHOO} = ( index( $ua, "yahoo" ) != -1 )
&& ( index( $ua, 'jp.co.yahoo.android' ) == -1 );
$tests->{MSN} = (
( index( $ua, "msnbot" ) != -1 || index( $ua, "bingbot" ) ) != -1 );
$tests->{MSNMOBILE} = (
( index( $ua, "msnbot-mobile" ) != -1
|| index( $ua, "bingbot-mobile" )
) != -1
);
$tests->{AHREFS} = ( index( $ua, "ahrefsbot" ) != -1 );
$tests->{ALTAVISTA} = ( index( $ua, "altavista" ) != -1 );
$tests->{ASKJEEVES} = ( index( $ua, "ask jeeves/teoma" ) != -1 );
$tests->{BAIDU} = ( index( $ua, "baiduspider" ) != -1 );
$tests->{CURL} = ( index( $ua, "libcurl" ) != -1 );
$tests->{FACEBOOK} = ( index( $ua, "facebookexternalhit" ) != -1 );
$tests->{GETRIGHT} = ( index( $ua, "getright" ) != -1 );
$tests->{GOOGLEADSBOT} = ( index( $ua, "adsbot-google" ) != -1 );
$tests->{GOOGLEADSENSE} = ( index( $ua, "mediapartners-google" ) != -1 );
$tests->{GOOGLEBOTIMAGE} = ( index( $ua, "googlebot-image" ) != -1 );
$tests->{GOOGLEBOTNEWS} = ( index( $ua, "googlebot-news" ) != -1 );
$tests->{GOOGLEBOTVIDEO} = ( index( $ua, "googlebot-video" ) != -1 );
$tests->{GOOGLEMOBILE} = ( index( $ua, "googlebot-mobile" ) != -1 );
$tests->{GOOGLE} = ( index( $ua, "googlebot" ) != -1 );
$tests->{INFOSEEK} = ( index( $ua, "infoseek" ) != -1 );
$tests->{LINKEXCHANGE} = ( index( $ua, "lecodechecker" ) != -1 );
$tests->{LINKCHECKER} = ( index( $ua, "linkchecker" ) != -1 );
$tests->{LYCOS} = ( index( $ua, "lycos" ) != -1 );
$tests->{PUF} = ( index( $ua, "puf/" ) != -1 );
$tests->{SCOOTER} = ( index( $ua, "scooter" ) != -1 );
$tests->{SLURP} = ( index( $ua, "slurp" ) != -1 );
$tests->{SPECIALARCHIVER} = ( index( $ua, "special_archiver" ) != -1 );
$tests->{WEBCRAWLER} = ( index( $ua, "webcrawler" ) != -1 );
$tests->{WGET} = ( index( $ua, "wget" ) != -1 );
$tests->{YANDEX} = ( index( $ua, "yandexbot" ) != -1 );
$tests->{YANDEXIMAGES} = ( index( $ua, "yandeximages" ) != -1 );
$tests->{ROBOT}
= ( $tests->{AHREFS}
|| $tests->{ALTAVISTA}
|| $tests->{ASKJEEVES}
|| $tests->{BAIDU}
|| $tests->{FACEBOOK}
|| $tests->{GETRIGHT}
|| $tests->{GOOGLEADSBOT}
|| $tests->{GOOGLEADSENSE}
|| $tests->{GOOGLEMOBILE}
|| $tests->{GOOGLEBOTNEWS}
|| $tests->{GOOGLEBOTIMAGE}
|| $tests->{GOOGLEBOTVIDEO}
|| $tests->{GOOGLE}
|| $tests->{INFOSEEK}
|| $tests->{JAVA}
|| $tests->{LINKEXCHANGE}
|| $tests->{LINKCHECKER}
|| $tests->{LWP}
|| $tests->{LYCOS}
|| $tests->{MSNMOBILE}
|| $tests->{MSN}
|| $tests->{PUF}
|| $tests->{SLURP}
|| $tests->{SPECIALARCHIVER}
|| $tests->{WEBCRAWLER}
|| $tests->{WGET}
|| $tests->{YAHOO}
|| $tests->{YANDEX}
|| $tests->{YANDEXIMAGES} )
|| index( $ua, "agent" ) != -1
|| index( $ua, "bot" ) != -1
|| index( $ua, "copy" ) != -1
|| index( $ua, "crawl" ) != -1
|| index( $ua, "fetch" ) != -1
|| index( $ua, "find" ) != -1
|| index( $ua, "ia_archive" ) != -1
|| index( $ua, "index" ) != -1
|| index( $ua, "reap" ) != -1
|| index( $ua, "spider" ) != -1
|| index( $ua, "worm" ) != -1
|| index( $ua, "zyborg" ) != -1
|| $ua =~ /seek (?! mo (?: toolbar )? \s+ \d+\.\d+ )/x
|| $ua =~ /search (?! [\w\s]* toolbar \b | bar \b )/x;
# Yahoo Slurp! hack this should apply to most browsers, but there's a case
# where GoogleBot masquerades as Safari on iOS. not sure how to handle
# that.
delete $tests->{FIREFOX} if $self->robot;
}
sub _os_tests {
my $self = shift;
my $tests = $self->{tests};
my $ua = lc $self->{user_agent};
$tests->{WIN16}
= ( index( $ua, "win16" ) != -1
|| index( $ua, "16bit" ) != -1
|| index( $ua, "windows 3" ) != -1
|| index( $ua, "windows 16-bit" ) != -1 );
$tests->{WIN3X}
= ( index( $ua, "win16" ) != -1
|| index( $ua, "windows 3" ) != -1
|| index( $ua, "windows 16-bit" ) != -1 );
$tests->{WIN31}
= ( index( $ua, "win16" ) != -1
|| index( $ua, "windows 3.1" ) != -1
|| index( $ua, "windows 16-bit" ) != -1 );
$tests->{WIN95}
= ( index( $ua, "win95" ) != -1 || index( $ua, "windows 95" ) != -1 );
$tests->{WIN98}
= ( index( $ua, "win98" ) != -1 || index( $ua, "windows 98" ) != -1 );
$tests->{WINNT}
= ( index( $ua, "winnt" ) != -1
|| index( $ua, "windows nt" ) != -1
|| index( $ua, "nt4" ) != -1
|| index( $ua, "nt3" ) != -1 );
$tests->{WIN2K}
= ( index( $ua, "nt 5.0" ) != -1 || index( $ua, "nt5" ) != -1 );
$tests->{WINXP} = ( index( $ua, "nt 5.1" ) != -1 );
$tests->{WIN2K3} = ( index( $ua, "nt 5.2" ) != -1 );
$tests->{WINVISTA} = ( index( $ua, "nt 6.0" ) != -1 );
$tests->{WIN7} = ( index( $ua, "nt 6.1" ) != -1 );
$tests->{WIN8_0} = ( index( $ua, "nt 6.2" ) != -1 );
$tests->{WIN8_1} = ( index( $ua, "nt 6.3" ) != -1 );
$tests->{WIN8} = ( $tests->{WIN8_0} || $tests->{WIN8_1} );
$tests->{DOTNET} = ( index( $ua, ".net clr" ) != -1 );
$tests->{WINME} = ( index( $ua, "win 9x 4.90" ) != -1 ); # whatever
$tests->{WIN32} = (
( $tests->{WIN95}
|| $tests->{WIN98}
|| $tests->{WINME}
|| $tests->{WINNT}
|| $tests->{WIN2K}
)
|| $tests->{WINXP}
|| $tests->{WIN2K3}
|| $tests->{WINVISTA}
|| $tests->{WIN7}
|| $tests->{WIN8}
|| index( $ua, "win32" ) != -1
);
$tests->{WINDOWS} = (
( $tests->{WIN16}
|| $tests->{WIN31}
|| $tests->{WIN95}
|| $tests->{WIN98}
|| $tests->{WINNT}
|| $tests->{WIN32}
|| $tests->{WIN2K}
|| $tests->{WINXP}
|| $tests->{WIN2K3}
|| $tests->{WINVISTA}
|| $tests->{WIN7}
|| $tests->{WIN8}
|| $tests->{WINME}
|| $tests->{WINCE}
|| $tests->{WINPHONE}
)
|| index( $ua, "win" ) != -1
);
$tests->{WINPHONE7} = ( index( $ua, "windows phone os 7.0" ) != -1 );
$tests->{WINPHONE7_5} = ( index( $ua, "windows phone os 7.5" ) != -1 );
$tests->{WINPHONE8} = ( index( $ua, "windows phone 8.0" ) != -1 );
# Mac operating systems
$tests->{MAC}
= ( index( $ua, "macintosh" ) != -1 || index( $ua, "mac_" ) != -1 );
$tests->{MACOSX} = ( index( $ua, "macintosh" ) != -1
&& index( $ua, "mac os x" ) != -1 );
$tests->{MAC68K} = ( ( $tests->{MAC} )
&& ( index( $ua, "68k" ) != -1 || index( $ua, "68000" ) != -1 ) );
$tests->{MACPPC}
= ( ( $tests->{MAC} )
&& ( index( $ua, "ppc" ) != -1 || index( $ua, "powerpc" ) != -1 )
);
$tests->{IOS} = $tests->{IPAD} || $tests->{IPOD} || $tests->{IPHONE};
# Others
$tests->{AMIGA} = ( index( $ua, 'amiga' ) != -1 );
$tests->{EMACS} = ( index( $ua, 'emacs' ) != -1 );
$tests->{OS2} = ( index( $ua, 'os/2' ) != -1 );
$tests->{SUN} = ( index( $ua, "sun" ) != -1 );
$tests->{SUN4} = ( index( $ua, "sunos 4" ) != -1 );
$tests->{SUN5} = ( index( $ua, "sunos 5" ) != -1 );
$tests->{SUNI86} = ( ( $tests->{SUN} ) && index( $ua, "i86" ) != -1 );
$tests->{IRIX} = ( index( $ua, "irix" ) != -1 );
$tests->{IRIX5} = ( index( $ua, "irix5" ) != -1 );
$tests->{IRIX6} = ( index( $ua, "irix6" ) != -1 );
$tests->{HPUX} = ( index( $ua, "hp-ux" ) != -1 );
$tests->{HPUX9} = ( ( $tests->{HPUX} ) && index( $ua, "09." ) != -1 );
$tests->{HPUX10} = ( ( $tests->{HPUX} ) && index( $ua, "10." ) != -1 );
$tests->{AIX} = ( index( $ua, "aix" ) != -1 );
$tests->{AIX1} = ( index( $ua, "aix 1" ) != -1 );
$tests->{AIX2} = ( index( $ua, "aix 2" ) != -1 );
$tests->{AIX3} = ( index( $ua, "aix 3" ) != -1 );
$tests->{AIX4} = ( index( $ua, "aix 4" ) != -1 );
$tests->{LINUX} = ( index( $ua, "inux" ) != -1 );
$tests->{SCO} = $ua =~ m{(?:SCO|unix_sv)};
$tests->{UNIXWARE} = ( index( $ua, "unix_system_v" ) != -1 );
$tests->{MPRAS} = ( index( $ua, "ncr" ) != -1 );
$tests->{RELIANT} = ( index( $ua, "reliantunix" ) != -1 );
$tests->{DEC}
= ( index( $ua, "dec" ) != -1
|| index( $ua, "osf1" ) != -1
|| index( $ua, "declpha" ) != -1
|| index( $ua, "alphaserver" ) != -1
|| index( $ua, "ultrix" ) != -1
|| index( $ua, "alphastation" ) != -1 );
$tests->{SINIX} = ( index( $ua, "sinix" ) != -1 );
$tests->{FREEBSD} = ( index( $ua, "freebsd" ) != -1 );
$tests->{BSD} = ( index( $ua, "bsd" ) != -1 );
$tests->{X11} = ( index( $ua, "x11" ) != -1 );
$tests->{UNIX}
= ( $tests->{X11}
|| $tests->{SUN}
|| $tests->{IRIX}
|| $tests->{HPUX}
|| $tests->{SCO}
|| $tests->{UNIXWARE}
|| $tests->{MPRAS}
|| $tests->{RELIANT}
|| $tests->{DEC}
|| $tests->{LINUX}
|| $tests->{BSD} );
$tests->{VMS}
= ( index( $ua, "vax" ) != -1 || index( $ua, "openvms" ) != -1 );
$tests->{ANDROID} = ( index( $ua, "android" ) != -1 );
$tests->{FIREFOXOS}
= ( $tests->{FIREFOX}
&& ($tests->{MOBILE} || $tests->{TABLET})
&& !$tests->{ANDROID}
&& index( $ua, "fennec" ) == -1 );
$tests->{RIMTABLETOS} = ( index( $ua, "rim tablet os" ) != -1 );
$tests->{PS3GAMEOS} = $tests->{PS3} && $tests->{NETFRONT};
$tests->{PSPGAMEOS} = $tests->{PSP} && $tests->{NETFRONT};
}
# undocumented, experimental, volatile. not bothering with major/minor here as
# that's flawed for 3 point versions the plan is to move this parsing into the
# UeberAgent parser
sub os_version {
my $self = shift;
if ( $self->ios && $self->{user_agent} =~ m{OS (\d*_\d*|\d*_\d*_\d*) like Mac} ) {
my $version = $1;
$version =~ s{_}{.}g;
return $version;
}
if ( $self->mac && $self->{user_agent} =~ m{ X \s (\d\d)_(\d)_(\d)}x ) {
return join '.', $1, $2, $3;
}
# firefox in mac
# "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:25.0) Gecko/20100101 Firefox/25.0"
if ( $self->mac && $self->{user_agent} =~ m{ X \s (\d\d\.\d)}x ) {
return $1;
}
if ( $self->winphone
&& $self->{user_agent} =~ m{Windows \s Phone \s \w{0,2} \s{0,1} (\d+\.\d+);}x )
{
return $1;
}
if ( $self->android && $self->{user_agent} =~ m{Android ([\d\.\w-]*)} ) {
return $1;
}
if ( $self->firefoxos && $self->{user_agent} =~ m{Firefox/([\d\.]*)} ) {
return $1;
}
}
# because the internals are the way they are, these tests have to happen in a
# certain order. hopefully we can change this once we have lazily loaded
# attributes. in the meantime, a pile of returns will do the job. if we
# changed this to use a hash, we'd still need a carefully ordered array of keys
# in order to get something useful back. so, as it is, this actually wouldn't
# be that much less verbose and the order of operations is quite clear. it
# still feels dirty, though. it does highlight the fact that way too many
# methods can return true for some UA strings, which means there are probably a
# lot of false positives we haven't checked for.
sub browser_string {
my ( $self ) = _self_or_default( @_ );
return undef unless defined $self->{user_agent};
return 'Netscape' if $self->netscape;
return 'IceWeasel' if $self->iceweasel;
return 'Firefox' if $self->firefox;
return 'BlackBerry' if $self->blackberry;
return 'Mobile Safari' if $self->mobile_safari;
return 'RealPlayer' if $self->realplayer_browser;
return 'Safari' if $self->safari;
return 'Chrome' if $self->chrome;
return 'AOL Browser' if $self->aol;
return 'MSIE' if $self->ie;
return 'WebTV' if $self->webtv;
return 'Obigo' if $self->obigo;
return 'Nintendo DSi' if $self->dsi;
return 'Opera' if $self->opera;
return 'Mosaic' if $self->mosaic;
return 'Lynx' if $self->lynx;
return 'ELinks' if $self->elinks;
return 'Links' if $self->links;
return 'curl' if $self->curl;
return 'puf' if $self->puf;
return 'NetFront' if $self->netfront;
return 'Nintendo 3DS' if $self->n3ds;
return undef;
}
sub os_string {
my ( $self ) = _self_or_default( @_ );
return undef unless defined $self->{user_agent};
return 'Win95' if $self->win95;
return 'Win98' if $self->win98;
return 'Win2k' if $self->win2k;
return 'WinXP' if $self->winxp;
return 'Win2k3' if $self->win2k3;
return 'WinVista' if $self->winvista;
return 'Win7' if $self->win7;
return 'Win8' if $self->win8_0;
return 'Win8.1' if $self->win8_1;
return 'WinNT' if $self->winnt;
return 'Windows Phone' if $self->winphone;
return 'Win3x' if $self->win3x;
return 'Android' if $self->android;
return 'Linux' if $self->linux;
return 'Unix' if $self->unix;
return 'Firefox OS' if $self->firefoxos;
return 'RIM Tablet OS' if $self->rimtabletos;
return 'Playstation 3 GameOS' if $self->ps3gameos;
return 'Playstation Portable GameOS' if $self->pspgameos;
return 'iOS' if $self->iphone || $self->ipod || $self->ipad;
return 'Mac OS X' if $self->macosx;
return 'Mac' if $self->mac;
return 'OS2' if $self->os2;
return undef;
}
sub realplayer {
my ( $self, $check ) = _self_or_default( @_ );
return 1 if $self->{tests}->{REALPLAYER};
return 0;
}
sub _realplayer_version {
my ( $self, $check ) = _self_or_default( @_ );
if ( exists $self->{realplayer_version}
&& $self->{realplayer_version} )
{
my @version = split( /\./, $self->{realplayer_version} );
$self->{major} = shift @version;
$self->{minor} = $self->_format_minor( shift @version );
$self->{realplayer_version} = $self->{major} + $self->{minor};
return $self->{realplayer_version};
}
return 0;
}
sub realplayer_browser {
my ( $self, $check ) = _self_or_default( @_ );
return 1 if $self->{realplayer_version};
return 0;
}
sub gecko_version {
my ( $self, $check ) = _self_or_default( @_ );
my $version;
$version = $self->{gecko_version};
if ( defined $check ) {
return $check == $version;
}
else {
return $version;
}
}
sub version {
my ( $self, $check ) = _self_or_default( @_ );
return $self->_realplayer_version if $self->_realplayer_version;
my $version = $self->{major} + $self->{minor};
if ( defined $check ) {
return $check == $version;
}
else {
return $version;
}
}
sub major {
my ( $self, $check ) = _self_or_default( @_ );
my ( $version ) = $self->{major};
if ( defined $check ) {
return $check == $version;
}
else {
return $version;
}
}
sub minor {
my ( $self, $check ) = _self_or_default( @_ );
my ( $version ) = $self->{minor};
if ( defined $check ) {
return ( $check == $self->{minor} );
}
else {
return $version;
}
}
sub public_version {
my ( $self, $check ) = _self_or_default( @_ );
my ( $major, $minor ) = $self->_public;
return $major + $minor;
}
sub public_major {
my ( $self, $check ) = _self_or_default( @_ );
my ( $major, $minor ) = $self->_public;
return $major;
}
sub public_minor {
my ( $self, $check ) = _self_or_default( @_ );
my ( $major, $minor ) = $self->_public;
return $minor;
}
sub public_beta {
my ( $self, $check ) = _self_or_default( @_ );
my ( $major, $minor, $beta ) = $self->_public;
return $beta;
}
sub _public {
my ( $self, $check ) = _self_or_default( @_ );
# Return Public version of Safari. See RT #48727.
if ( $self->safari ) {
my $ua = lc $self->{user_agent};
# Safari starting with version 3.0 provides its own public version
if ($ua =~ m{
version/
( \d+ ) # Major version number is everything before first dot
( \. \d+ )? # Minor version number is first dot and following digits
}x
)
{
return ( $1, $2, undef );
}
# Safari before version 3.0 had only build numbers; use a lookup table
# provided by Apple to convert to version numbers
if ( $ua =~ m{ safari/ ( \d+ (?: \.\d+ )* ) }x ) {
my $build = $1;
my $version = $safari_build_to_version{$build};
unless ( $version ) {
# if exact build -> version mapping doesn't exist, find next
# lower build
for my $maybe_build (
sort { $self->_cmp_versions( $b, $a ) }
keys %safari_build_to_version
)
{
$version = $safari_build_to_version{$maybe_build}, last
if $self->_cmp_versions( $build, $maybe_build ) >= 0;
}
}
my ( $major, $minor ) = split /\./, $version;
my $beta;
$minor =~ s/(\D.*)// and $beta = $1;
$minor = 0 + ( '.' . $minor );
return ( $major, $minor, ( $beta ? 1 : undef ) );
}
}
return ( $self->major, $self->minor, $self->beta( $check ) );
}
sub _cmp_versions {
my ( $self, $a, $b ) = @_;
my @a = split /\./, $a;
my @b = split /\./, $b;
while ( @b ) {
return -1 if @a == 0 || $a[0] < $b[0];
return 1 if @b == 0 || $b[0] < $a[0];
shift @a;
shift @b;
}
return @a <=> @b;
}
sub engine_string {
my ( $self, $check ) = _self_or_default( @_ );
if ( $self->{user_agent} =~ m{\bKHTML\b} ) {
return 'KHTML';
}
if ( $self->gecko ) {
return 'Gecko';
}
if ( $self->trident ) {
return 'Trident';
}
if ( $self->ie ) {
return 'MSIE';
}
if ( $self->netfront ) {
return 'NetFront';
}
return undef;
}
sub _engine {
my ( $self, $check ) = _self_or_default( @_ );
return $self->{engine_version};
}
sub engine_version {
my ( $self, $check ) = _self_or_default( @_ );
if ( $self->_engine ) {
return $self->engine_major + $self->engine_minor;
}
return undef;
}
sub engine_major {
my ( $self, $check ) = _self_or_default( @_ );
if ( $self->_engine ) {
my @version = split( /\./, $self->_engine );
return shift @version;
}
return undef;
}
sub engine_minor {
my ( $self, $check ) = _self_or_default( @_ );
if ( $self->_engine ) {
my @version = split( /\./, $self->_engine );
shift @version;
return $self->_format_minor( shift @version );
}
return undef;
}
sub beta {
my ( $self, $check ) = _self_or_default( @_ );
my ( $version ) = $self->{beta};
if ( $check ) {
return $check eq $version;
}
else {
return $version;
}
}
sub language {
my ( $self, $check ) = _self_or_default( @_ );
my $parsed = $self->_language_country();
return $parsed->{'language'};
}
sub country {
my ( $self, $check ) = _self_or_default( @_ );
my $parsed = $self->_language_country();
return $parsed->{'country'};
}
sub device {
my ( $self, $check ) = _self_or_default( @_ );
foreach my $device ( sort keys %DEVICE_TESTS ) {
return $device if ( $self->$device );
}
return undef;
}
sub device_name {
my ( $self, $check ) = _self_or_default( @_ );
return $self->{device_name} if defined $self->{device_name};
my $device = $self->device;
return undef if !$device;
return $DEVICE_TESTS{ $self->device };
}
sub _language_country {
my ( $self, $check ) = _self_or_default( @_ );
if ( $self->safari ) {
if ( $self->major == 1
&& $self->{user_agent} =~ m/\s ( [a-z]{2} ) \)/xms )
{
return { language => uc $1 };
}
if ( $self->{user_agent} =~ m/\s ([a-z]{2})-([A-Za-z]{2})/xms ) {
return { language => uc $1, country => uc $2 };
}
}
if ( $self->aol
&& $self->{user_agent} =~ m/;([A-Z]{2})_([A-Z]{2})\)/ )
{
return { language => $1, country => $2 };
}
if ( $self->{user_agent} =~ m/\b([a-z]{2})-([A-Za-z]{2})\b/xms ) {
return { language => uc $1, country => uc $2 };
}
if ( $self->{user_agent} =~ m/\[([a-z]{2})\]/xms ) {
return { language => uc $1 };
}
if ( $self->{user_agent} =~ m/\(([^)]+)\)/xms ) {
my @parts = split( /;/, $1 );
foreach my $part ( @parts ) {
if ( $part =~ /^\s*([a-z]{2})\s*$/ ) {
return { language => uc $1 };
}
}
}
return { language => undef, country => undef };
}
sub _format_minor {
my $self = shift;
my $minor = shift;
return 0 + ( '.' . ( $minor || 0 ) );
}
sub browser_properties {
my ( $self, $check ) = _self_or_default( @_ );
my @browser_properties;
foreach my $property ( sort keys %{ $self->{tests} } ) {
push @browser_properties, lc( $property )
if ( ${ $self->{tests} }{$property} );
}
# devices are a property too but it's not stored in %tests
# so I explicitly test for it and add it
push @browser_properties, 'device' if ( $self->device() );
return @browser_properties;
}
sub robot_name {
my $self = shift;
foreach my $name ( @ROBOT_TESTS ) {
next if $name eq 'robot';
if ( $self->$name ) {
return $ROBOTS{$name};
}
}
}
1;
# ABSTRACT: Determine Web browser, version, and platform from an HTTP user agent string
__END__
=pod
=encoding UTF-8
=head1 NAME
HTTP::BrowserDetect - Determine Web browser, version, and platform from an HTTP user agent string
=head1 VERSION
version 1.68
=head1 SYNOPSIS
use HTTP::BrowserDetect;
my $browser = HTTP::BrowserDetect->new($user_agent_string);
# Detect operating system
if ($browser->windows) {
if ($browser->winnt) ...
if ($browser->win95) ...
}
print $browser->mac;
# Detect browser vendor and version
print $browser->netscape;
print $browser->ie;
if (browser->major(4)) {
if ($browser->minor() > .5) {
...
}
}
if ($browser->version() > 4) {
...;
}
=head1 DESCRIPTION
The HTTP::BrowserDetect object does a number of tests on an HTTP user agent
string. The results of these tests are available via methods of the object.
This module is based upon the JavaScript browser detection code available at
L<http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html>.
=head1 CONSTRUCTOR AND STARTUP
=head2 new()
HTTP::BrowserDetect->new( $user_agent_string )
The constructor may be called with a user agent string specified. Otherwise, it
will use the value specified by $ENV{'HTTP_USER_AGENT'}, which is set by the
web server when calling a CGI script.
You may also use a non-object-oriented interface. For each method, you may call
HTTP::BrowserDetect::method_name(). You will then be working with a default
HTTP::BrowserDetect object that is created behind the scenes.
=head1 SUBROUTINES/METHODS
=head2 user_agent()
Returns the value of the user agent string.
Calling this method with a parameter has now been deprecated and this feature
will be removed in an upcoming release.
=head2 country()
Returns the country string as it may be found in the user agent string. This
will be in the form of an upper case 2 character code. ie: US, DE, etc
=head2 language()
Returns the language string as it is found in the user agent string. This will
be in the form of an upper case 2 character code. ie: EN, DE, etc
=head2 device()
Returns the method name of the actual hardware, if it can be detected.
Currently returns one of: android, audrey, blackberry, dsi, iopener, ipad,
iphone, ipod, kindle, n3ds, palm, ps3, psp, wap, webos. Returns C<undef> if no
hardware can be detected
=head2 device_name()
Returns a human formatted version of the hardware device name. These names are
subject to change and are really meant for display purposes. You should use
the device() method in your logic. Returns one of: Android, Audrey,
BlackBerry, Nintendo DSi, iopener, iPad, iPhone, iPod, Amazon Kindle, Nintendo
3DS, Palm, Sony PlayStation 3, Sony Playstation Portable, WAP capable phone,
webOS. Also Windows-based smartphones will output various different names like
HTC T7575. Returns C<undef> if this is not a device or if no device name can be
detected.
=head2 browser_properties()
Returns a list of the browser properties, that is, all of the tests that passed
for the provided user_agent string. Operating systems, devices, browser names,
mobile and robots are all browser properties.
=head1 Detecting Browser Version
Please note that that the version(), major() and minor() methods have been
superceded as of release 1.07 of this module. They are not yet deprecated, but
should be replaced with public_version(), public_major() and public_minor() in
new development.
The reasoning behind this is that version() method will, in the case of Safari,
return the Safari/XXX numbers even when Version/XXX numbers are present in the
UserAgent string. Because this behaviour has been in place for so long, some
clients may have come to rely upon it. So, it has been retained in the interest
of "bugwards compatibility", but in almost all cases, the numbers returned by
public_version(), public_major() and public_minor() will be what you are
looking for.
=head2 public_version()
Returns the browser version as a floating-point number.
=head2 public_major()
Returns the integer portion of the browser version.
=head2 public_minor()
Returns the decimal portion of the browser version as a B<floating-point
number> less than 1. For example, if the version is 4.05, this method returns
.05; if the version is 4.5, this method returns .5.
On occasion a version may have more than one decimal point, such as
'Wget/1.4.5'. The minor version does not include the second decimal point, or
any further digits or decimals.
=head2 version($version)
Returns the version as a floating-point number. If passed a parameter, returns
true if it is equal to the version specified by the user agent string.
=head2 major($major)
Returns the integer portion of the browser version. If passed a parameter,
returns true if it equals the browser major version.
=head2 minor($minor)
Returns the decimal portion of the browser version as a B<floating-point
number> less than 1. For example, if the version is 4.05, this method returns
.05; if the version is 4.5, this method returns .5. B<This is a change in
behavior from previous versions of this module, which returned a string>.
If passed a parameter, returns true if equals the minor version.
On occasion a version may have more than one decimal point, such as
'Wget/1.4.5'. The minor version does not include the second decimal point, or
any further digits or decimals.
=head2 beta($beta)
Returns any the beta version, consisting of any non-numeric characters after
the version number. For instance, if the user agent string is 'Mozilla/4.0
(compatible; MSIE 5.0b2; Windows NT)', returns 'b2'. If passed a parameter,
returns true if equal to the beta version. If the beta starts with a dot, it
is thrown away.
=head1 Detecting Rendering Engine
=head2 engine_string()
Returns one of the following:
Gecko, KHTML, Trident, MSIE, NetFront
Returns C<undef> if no string can be found.
=head2 engine_version()
Returns the version number of the rendering engine. Currently this only
returns a version number for Gecko and Trident. Returns C<undef> for all
other engines. The output is simply C<engine_major> added with C<engine_minor>.
=head2 engine_major()
Returns the major version number of the rendering engine. Currently this only
returns a version number for Gecko and Trident. Returns C<undef> for all
other engines.
=head2 engine_minor()
Returns the minor version number of the rendering engine. Currently this only
returns a version number for Gecko and Trident. Returns C<undef> for all
other engines.
=head1 Detecting OS Platform and Version
The following methods are available, each returning a true or false value.
Some methods also test for the operating system version. The indentations
below show the hierarchy of tests (for example, win2k is considered a type of
winnt, which is a type of win32)
=head2 windows()
win16 win3x win31
win32
winme win95 win98
winnt
win2k winxp win2k3 winvista win7
win8
win8_0 win8_1
wince
winphone
winphone7 winphone7_5 winphone8
=head2 dotnet()
=head2 firefoxos()
=head2 mac()
mac68k macppc macosx ios
=head2 os2()
=head2 rimtabletos()
=head2 unix()
sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10
aix aix1 aix2 aix3 aix4 linux sco unixware mpras reliant
dec sinix freebsd bsd
=head2 vms()
=head2 amiga()
=head2 ps3gameos()
=head2 pspgameos()
It may not be possibile to detect Win98 in Netscape 4.x and earlier. On Opera
3.0, the userAgent string includes "Windows 95/NT4" on all Win32, so you can't
distinguish between Win95 and WinNT.
=head2 os_string()
Returns one of the following strings, or undef. This method exists solely for
compatibility with the L<HTTP::Headers::UserAgent> module.
Win95, Win98, WinNT, Win2K, WinXP, Win2k3, WinVista, Win7, Win8,
Win8.1, Windows Phone, Mac, Mac OS X, iOS, Win3x, OS2, Unix, Linux,
Firefox OS, Playstation 3 GameOS, Playstation Portable GameOS,
RIM Tablet OS
=head1 Detecting Browser Vendor
The following methods are available, each returning a true or false value.
Some methods also test for the browser version, saving you from checking the
version separately.
=head3 aol aol3 aol4 aol5 aol6
=head3 chrome
=head3 curl
=head3 emacs
=head3 firefox
=head3 gecko
=head3 icab
=head3 ie ie3 ie4 ie4up ie5 ie55 ie6 ie7 ie8 ie9 ie10 ie11
=head3 ie_compat_mode
The ie_compat_mode is used to determine if the IE user agent is for
the compatibility mode view, in which case the real version of IE is
higher than that detected. The true version of IE can be inferred from
the version of Trident in the engine_version method.
=head3 java
=head3 konqueror
=head3 lotusnotes
=head3 lynx links elinks
=head3 mobile_safari
=head3 mosaic
=head3 mozilla
=head3 neoplanet neoplanet2
=head3 netfront
=head3 netscape nav2 nav3 nav4 nav4up nav45 nav45up navgold nav6 nav6up
=head3 opera opera3 opera4 opera5 opera6 opera7
=head3 realplayer
=head3 realplayer_browser
The realplayer method above tests for the presence of either the RealPlayer
plug-in "(r1 " or the browser "RealPlayer". To preserve "bugwards
compatibility" and prevent false reporting, browser_string calls this method
which ignores the "(r1 " plug-in signature.
=head3 safari
=head3 staroffice
=head3 webtv
Netscape 6, even though its called six, in the User-Agent string has version
number 5. The nav6 and nav6up methods correctly handle this quirk. The Firefox
test correctly detects the older-named versions of the browser (Phoenix,
Firebird).
=head2 browser_string()
Returns undef on failure. Otherwise returns one of the following:
Netscape, Firefox, Safari, Chrome, MSIE, WebTV, AOL Browser, Opera, Mosaic,
Lynx, Links, ELinks, RealPlayer, IceWeasel, curl, puf, NetFront, Mobile Safari,
BlackBerry.
=head2 gecko_version()
If a Gecko rendering engine is used (as in Mozilla or Firefox), returns the
version of the renderer (e.g. 1.3a, 1.7, 1.8) This might be more useful than
the particular browser name or version when correcting for quirks in different
versions of this rendering engine. If no Gecko browser is being used, or the
version number can't be detected, returns undef.
=head1 Detecting Other Devices
The following methods are available, each returning a true or false value.
=head3 android
=head3 audrey
=head3 avantgo
=head3 blackberry
=head3 dsi
=head3 iopener
=head3 iphone
=head3 ipod
=head3 ipad
=head3 kindle
=head3 n3ds
=head3 obigo
=head3 palm
=head3 webos
=head3 wap
=head3 psp
=head3 ps3
=head2 mobile()
Returns true if the browser appears to belong to a handheld device.
=head2 tablet()
Returns true if the browser appears to belong to a tablet device.
=head2 robot()
Returns true if the user agent appears to be a robot, spider, crawler, or other
automated Web client.
The following additional methods are available, each returning a true or false
value. This is by no means a complete list of robots that exist on the Web.
=head3 ahrefs
=head3 altavista
=head3 askjeeves
=head3 baidu
=head3 facebook
=head3 getright
=head3 google
=head3 googleadsbot
=head3 googleadsense
=head3 googlemobile
=head3 infoseek
=head3 linkexchange
=head3 lwp
=head3 lycos
=head3 msn (same as bing)
=head3 puf
=head3 slurp
=head3 webcrawler
=head3 wget
=head3 yahoo
=head3 yandex
=head3 yandeximages
=head1 CREDITS
Lee Semel, lee@semel.net (Original Author)
Peter Walsham (co-maintainer)
Olaf Alders, C<olaf at wundercounter.com> (co-maintainer)
=head1 ACKNOWLEDGEMENTS
Thanks to the following for their contributions:
cho45
Leonardo Herrera
Denis F. Latypoff
merlynkline
Simon Waters
Toni Cebrin
Florian Merges
david.hilton.p
Steve Purkis
Andrew McGregor
Robin Smidsrod
Richard Noble
Josh Ritter
Mike Clarke
Marc Sebastian Pelzer
Alexey Surikov
Maros Kollar
Jay Rifkin
Luke Saunders
Jacob Rask
Heiko Weber
Jon Jensen
Jesse Thompson
Graham Barr
Enrico Sorcinelli
Olivier Bilodeau
Yoshiki Kurihara
Paul Findlay
Uwe Voelker
Douglas Christopher Wilson
John Oatis
Atsushi Kato
Ronald J. Kimball
Bill Rhodes
Thom Blake
Aran Deltac
yeahoffline
David Ihnen
Hao Wu
Perlover
=head1 TO DO
The C<_engine()> method currently only handles Gecko and Trident. It needs to
be expanded to handle other rendering engines.
POD coverage is also not 100%.
=head1 SEE ALSO
"Browser ID (User-Agent) Strings", L<http://www.zytrax.com/tech/web/browser_ids.htm>
L<HTML::ParseBrowser>.
=head1
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc HTTP::BrowserDetect
You can also look for information at:
=over 4
=item * GitHub Source Repository
L<http://github.com/oalders/http-browserdetect>
=item * Reporting Issues
L<https://github.com/oalders/http-browserdetect/issues>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/HTTP-BrowserDetect>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/HTTP-BrowserDetect>
=item * Search CPAN
L<https://metacpan.org/module/HTTP::BrowserDetect>
=back
=head1 BUGS AND LIMITATIONS
The biggest limitation at this point is the test suite, which really needs to
have many more UserAgent strings to test against.
=head1 CONTRIBUTING
Patches are certainly welcome, with many thanks for the excellent contributions
which have already been received. The preferred method of patching would be to
fork the GitHub repo and then send me a pull request, but plain old patch files
are also welcome.
If you're able to add test cases, this will speed up the time to release your
changes. Just edit t/useragents.json so that the test coverage includes any
changes you have made. Please contact me if you have any questions.
This distribution uses L<Dist::Zilla>. If you're not familiar with this module,
please see L<https://github.com/oalders/http-browserdetect/issues/5> for some
helpful tips to get you started.
=head1 AUTHORS
=over 4
=item *
Lee Semel <lee@semel.net>
=item *
Peter Walsham
=item *
Olaf Alders <olaf@wundercounter.com> (current maintainer)
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Lee Semel.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|