Imported Upstream version 1.64
Angel Abad
10 years ago
19 | 19 | "Olaf Alders <olaf\@wundercounter.com> (current maintainer)" |
20 | 20 | ], |
21 | 21 | "dist_name" => "HTTP-BrowserDetect", |
22 | "dist_version" => "1.62", | |
22 | "dist_version" => "1.64", | |
23 | 23 | "license" => "perl", |
24 | 24 | "module_name" => "HTTP::BrowserDetect", |
25 | 25 | "recommends" => {}, |
42 | 42 | ); |
43 | 43 | |
44 | 44 | |
45 | my %fallback_build_requires = ( | |
46 | "File::Slurp" => 0, | |
47 | "FindBin" => 0, | |
48 | "JSON::PP" => 0, | |
49 | "Module::Build" => "0.3601", | |
50 | "Test::FailWarnings" => 0, | |
51 | "Test::More" => 0, | |
52 | "Test::Most" => 0, | |
53 | "Test::NoWarnings" => 0 | |
54 | ); | |
55 | ||
56 | ||
45 | 57 | unless ( eval { Module::Build->VERSION(0.4004) } ) { |
46 | my $tr = delete $module_build_args{test_requires}; | |
47 | my $br = $module_build_args{build_requires}; | |
48 | for my $mod ( keys %$tr ) { | |
49 | if ( exists $br->{$mod} ) { | |
50 | $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod}; | |
51 | } | |
52 | else { | |
53 | $br->{$mod} = $tr->{$mod}; | |
54 | } | |
55 | } | |
58 | delete $module_build_args{test_requires}; | |
59 | $module_build_args{build_requires} = \%fallback_build_requires; | |
56 | 60 | } |
57 | 61 | |
58 | 62 | my $build = Module::Build->new(%module_build_args); |
15 | 15 | * Olaf Alders <olaf@wundersolutions.com> |
16 | 16 | * Olivier Bilodeau <olivier@bottomlesspit.org> |
17 | 17 | * Paul Findlay <paul@findlay.net.nz> |
18 | * Robin Smidsrød <robin@smidsrod.no> | |
18 | * Robin Smidsrød <robin@smidsrod.no> | |
19 | 19 | * Ronald J Kimball <rkimball@pangeamedia.com> |
20 | 20 | * Surikov Alexey <surikov@alexey-pc.kiteventures.local> |
21 | 21 | * Thom Blake <thom@odonnellpdc.com> |
0 | 0 | Revision history for Perl extension HTTP::BrowserDetect. |
1 | ||
2 | 1.64 2013-11-25 10:10:23 America/Toronto | |
3 | - Adds detection for Opera 15+ (Douglas Christopher Wilson) | |
4 | ||
5 | 1.63 2013-11-21 21:39:46 America/Toronto | |
6 | - Adds detection for Internet Explorer 11 (Douglas Christopher Wilson) | |
7 | - Adds detection for Windows 8.1 (Douglas Christopher Wilson) | |
1 | 8 | |
2 | 9 | 1.62 2013-10-25 14:40:57 America/Toronto |
3 | 10 | - Returns explicit undef more consistently (David Ihnen) |
5 | 5 | "Olaf Alders <olaf@wundercounter.com> (current maintainer)" |
6 | 6 | ], |
7 | 7 | "dynamic_config" : 0, |
8 | "generated_by" : "Dist::Zilla version 4.300035, CPAN::Meta::Converter version 2.120921", | |
8 | "generated_by" : "Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.132830", | |
9 | 9 | "license" : [ |
10 | 10 | "perl_5" |
11 | 11 | ], |
62 | 62 | "web" : "https://github.com/oalders/http-browserdetect" |
63 | 63 | } |
64 | 64 | }, |
65 | "version" : "1.62", | |
65 | "version" : "1.64", | |
66 | 66 | "x_contributors" : [ |
67 | 67 | "Aran Deltac <bluefeet@gmail.com>", |
68 | 68 | "David Ihnen <davidihnen@gmail.com>", |
35 | 35 | "Test::Most" => 0, |
36 | 36 | "Test::NoWarnings" => 0 |
37 | 37 | }, |
38 | "VERSION" => "1.62", | |
38 | "VERSION" => "1.64", | |
39 | 39 | "test" => { |
40 | 40 | "TESTS" => "t/*.t" |
41 | 41 | } |
42 | 42 | ); |
43 | 43 | |
44 | 44 | |
45 | my %FallbackPrereqs = ( | |
46 | "File::Slurp" => 0, | |
47 | "FindBin" => 0, | |
48 | "JSON::PP" => 0, | |
49 | "Module::Build" => "0.3601", | |
50 | "Test::FailWarnings" => 0, | |
51 | "Test::More" => 0, | |
52 | "Test::Most" => 0, | |
53 | "Test::NoWarnings" => 0, | |
54 | "strict" => 0, | |
55 | "vars" => 0, | |
56 | "warnings" => 0 | |
57 | ); | |
58 | ||
59 | ||
45 | 60 | unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { |
46 | my $tr = delete $WriteMakefileArgs{TEST_REQUIRES}; | |
47 | my $br = $WriteMakefileArgs{BUILD_REQUIRES}; | |
48 | for my $mod ( keys %$tr ) { | |
49 | if ( exists $br->{$mod} ) { | |
50 | $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod}; | |
51 | } | |
52 | else { | |
53 | $br->{$mod} = $tr->{$mod}; | |
54 | } | |
55 | } | |
56 | } | |
57 | ||
58 | unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { | |
59 | my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; | |
60 | my $pp = $WriteMakefileArgs{PREREQ_PM}; | |
61 | for my $mod ( keys %$br ) { | |
62 | if ( exists $pp->{$mod} ) { | |
63 | $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; | |
64 | } | |
65 | else { | |
66 | $pp->{$mod} = $br->{$mod}; | |
67 | } | |
68 | } | |
61 | delete $WriteMakefileArgs{TEST_REQUIRES}; | |
62 | delete $WriteMakefileArgs{BUILD_REQUIRES}; | |
63 | $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; | |
69 | 64 | } |
70 | 65 | |
71 | 66 | delete $WriteMakefileArgs{CONFIGURE_REQUIRES} |
2 | 2 | an HTTP user agent string |
3 | 3 | |
4 | 4 | VERSION |
5 | version 1.62 | |
5 | version 1.64 | |
6 | 6 | |
7 | 7 | SYNOPSIS |
8 | 8 | use HTTP::BrowserDetect; |
181 | 181 | win32 |
182 | 182 | winme win95 win98 |
183 | 183 | winnt |
184 | win2k winxp win2k3 winvista win7 win8 | |
184 | win2k winxp win2k3 winvista win7 | |
185 | win8 | |
186 | win8_0 win8_1 | |
185 | 187 | wince |
186 | 188 | winphone |
187 | 189 | winphone7 winphone7_5 winphone8 |
211 | 213 | solely for compatibility with the HTTP::Headers::UserAgent module. |
212 | 214 | |
213 | 215 | Win95, Win98, WinNT, Win2K, WinXP, Win2k3, WinVista, Win7, Win8, |
214 | Windows Phone, Mac, Mac OS X, iOS, Win3x, OS2, Unix, Linux, | |
216 | Win8.1, Windows Phone, Mac, Mac OS X, iOS, Win3x, OS2, Unix, Linux, | |
215 | 217 | Firefox OS, Playstation 3 GameOS, Playstation Portable GameOS, |
216 | 218 | RIM Tablet OS |
217 | 219 | |
227 | 229 | firefox |
228 | 230 | gecko |
229 | 231 | icab |
230 | ie ie3 ie4 ie4up ie5 ie55 ie6 ie7 ie8 ie9 ie10 | |
232 | ie ie3 ie4 ie4up ie5 ie55 ie6 ie7 ie8 ie9 ie10 ie11 | |
231 | 233 | java |
232 | 234 | konqueror |
233 | 235 | lotusnotes |
4 | 4 | license = Perl_5 |
5 | 5 | copyright_holder = Lee Semel |
6 | 6 | copyright_year = 2013 |
7 | version = 1.62 | |
7 | version = 1.64 | |
8 | 8 | main_module = lib/HTTP/BrowserDetect.pm |
9 | 9 | |
10 | 10 | [GatherDir] |
2 | 2 | |
3 | 3 | package HTTP::BrowserDetect; |
4 | 4 | { |
5 | $HTTP::BrowserDetect::VERSION = '1.62'; | |
5 | $HTTP::BrowserDetect::VERSION = '1.64'; | |
6 | 6 | } |
7 | 7 | |
8 | 8 | use vars qw(@ALL_TESTS); |
21 | 21 | win95 win98 winnt |
22 | 22 | winme win32 win2k |
23 | 23 | winxp win2k3 winvista |
24 | win7 win8 wince | |
25 | winphone winphone7 winphone7_5 | |
26 | winphone8 | |
24 | win7 win8 win8_0 | |
25 | win8_1 wince winphone | |
26 | winphone7 winphone7_5 winphone8 | |
27 | 27 | ); |
28 | 28 | |
29 | 29 | # More precise Mac |
88 | 88 | ie5 ie5up ie55 |
89 | 89 | ie55up ie6 ie7 |
90 | 90 | ie8 ie9 ie10 |
91 | ie11 | |
91 | 92 | ); |
92 | 93 | |
93 | 94 | our @OPERA_TESTS = qw( |
277 | 278 | |
278 | 279 | my $ua = lc $self->{user_agent}; |
279 | 280 | |
281 | # Trident Engine (detect early for sniffing out IE) | |
282 | $tests->{TRIDENT} = ( index( $ua, "trident/" ) != -1 ); | |
283 | ||
280 | 284 | # Browser version |
281 | 285 | my ( $major, $minor, $beta ) = ( |
282 | 286 | $ua =~ m{ |
322 | 326 | ( $major, $minor, $beta ) = split /\./, $1; |
323 | 327 | |
324 | 328 | } |
329 | elsif ($tests->{TRIDENT} && $ua =~ m{\b rv: ( [0-9\.]+ ) \b}x ) { | |
330 | # MSIE masking as Gecko really well ;) | |
331 | ( $major, $minor, $beta ) = split /\./, $1; | |
332 | } | |
333 | ||
334 | # Opera browsers | |
335 | ||
336 | $tests->{OPERA} | |
337 | = ( index( $ua, "opera" ) != -1 | |
338 | || index( $ua, "opr/" ) != -1 ); | |
339 | $tests->{OPERA3} | |
340 | = ( index( $ua, "opera 3" ) != -1 | |
341 | || index( $ua, "opera/3" ) != -1 ); | |
342 | $tests->{OPERA4} | |
343 | = ( index( $ua, "opera 4" ) != -1 ) | |
344 | || ( index( $ua, "opera/4" ) != -1 | |
345 | && ( index( $ua, "nintendo dsi" ) == -1 ) ); | |
346 | $tests->{OPERA5} | |
347 | = ( index( $ua, "opera 5" ) != -1 ) | |
348 | || ( index( $ua, "opera/5" ) != -1 ); | |
349 | $tests->{OPERA6} | |
350 | = ( index( $ua, "opera 6" ) != -1 ) | |
351 | || ( index( $ua, "opera/6" ) != -1 ); | |
352 | $tests->{OPERA7} | |
353 | = ( index( $ua, "opera 7" ) != -1 ) | |
354 | || ( index( $ua, "opera/7" ) != -1 ); | |
325 | 355 | |
326 | 356 | # Opera needs to be dealt with specifically |
327 | 357 | # http://dev.opera.com/articles/view/opera-ua-string-changes/ |
358 | # http://my.opera.com/community/openweb/idopera/ | |
328 | 359 | # Opera/9.80 (S60; SymbOS; Opera Mobi/320; U; sv) Presto/2.4.15 Version/10.00 |
360 | # 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 | |
329 | 361 | |
330 | 362 | if ( $ua =~ m{\AOpera.*\sVersion/(\d*)\.(\d*)\z}i ) { |
331 | 363 | $major = $1; |
332 | 364 | $minor = $2; |
333 | 365 | } |
366 | elsif ( $ua =~ m{\bOPR/(\d+)\.(\d+)}i ) { | |
367 | $major = $1; | |
368 | $minor = $2; | |
369 | } | |
334 | 370 | elsif ( $ua =~ m{NetFront/(\d*)\.(\d*) Kindle}i ) { |
335 | 371 | $major = $1; |
336 | 372 | $minor = $2; |
348 | 384 | $tests->{GECKO} = ( index( $ua, "gecko" ) != -1 ) |
349 | 385 | && ( index( $ua, "like gecko" ) == -1 ); |
350 | 386 | |
351 | $tests->{CHROME} = ( index( $ua, "chrome/" ) != -1 ); | |
387 | $tests->{CHROME} | |
388 | = ( !$tests->{OPERA} | |
389 | && index( $ua, "chrome/" ) != -1 ); | |
352 | 390 | $tests->{SAFARI} |
353 | 391 | = ( ( index( $ua, "safari" ) != -1 ) |
354 | 392 | || ( index( $ua, "applewebkit" ) != -1 ) ) |
397 | 435 | = ( !$tests->{FIREFOX} |
398 | 436 | && !$tests->{SAFARI} |
399 | 437 | && !$tests->{CHROME} |
438 | && !$tests->{OPERA} | |
439 | && !$tests->{TRIDENT} | |
400 | 440 | && index( $ua, "mozilla" ) != -1 |
401 | 441 | && index( $ua, "msie" ) == -1 |
402 | 442 | && index( $ua, "spoofer" ) == -1 |
403 | 443 | && index( $ua, "compatible" ) == -1 |
404 | && index( $ua, "opera" ) == -1 | |
405 | 444 | && index( $ua, "webtv" ) == -1 |
406 | 445 | && index( $ua, "hotjava" ) == -1 |
407 | 446 | && index( $ua, "nintendo" ) == -1 |
441 | 480 | |
442 | 481 | # Internet Explorer browsers |
443 | 482 | |
444 | $tests->{IE} = ( index( $ua, "msie" ) != -1 | |
483 | $tests->{IE} = ( $tests->{TRIDENT} | |
484 | || index( $ua, "msie" ) != -1 | |
445 | 485 | || index( $ua, 'microsoft internet explorer' ) != -1 ); |
446 | 486 | $tests->{IE3} = ( $tests->{IE} && $major == 3 ); |
447 | 487 | $tests->{IE4} = ( $tests->{IE} && $major == 4 ); |
456 | 496 | $tests->{IE8} = ( $tests->{IE} && $major == 8 ); |
457 | 497 | $tests->{IE9} = ( $tests->{IE} && $major == 9 ); |
458 | 498 | $tests->{IE10} = ( $tests->{IE} && $major == 10 ); |
499 | $tests->{IE11} = ( $tests->{IE} && $major == 11 ); | |
459 | 500 | |
460 | 501 | # Neoplanet browsers |
461 | 502 | |
474 | 515 | $tests->{AOL6} = ( index( $ua, "aol 6.0" ) != -1 ); |
475 | 516 | $tests->{AOLTV} = ( index( $ua, "navio" ) != -1 ) |
476 | 517 | || ( index( $ua, "navio_aoltv" ) != -1 ); |
477 | ||
478 | # Opera browsers | |
479 | ||
480 | $tests->{OPERA} = ( index( $ua, "opera" ) != -1 ); | |
481 | $tests->{OPERA3} = ( index( $ua, "opera 3" ) != -1 ) | |
482 | || ( index( $ua, "opera/3" ) != -1 ); | |
483 | $tests->{OPERA4} = ( index( $ua, "opera 4" ) != -1 ) | |
484 | || ( index( $ua, "opera/4" ) != -1 | |
485 | && ( index( $ua, "nintendo dsi" ) == -1 ) ); | |
486 | $tests->{OPERA5} = ( index( $ua, "opera 5" ) != -1 ) | |
487 | || ( index( $ua, "opera/5" ) != -1 ); | |
488 | $tests->{OPERA6} = ( index( $ua, "opera 6" ) != -1 ) | |
489 | || ( index( $ua, "opera/6" ) != -1 ); | |
490 | $tests->{OPERA7} = ( index( $ua, "opera 7" ) != -1 ) | |
491 | || ( index( $ua, "opera/7" ) != -1 ); | |
492 | 518 | |
493 | 519 | # Other browsers |
494 | 520 | |
652 | 678 | |
653 | 679 | # Engines |
654 | 680 | |
655 | $tests->{TRIDENT} = ( index( $ua, "trident/" ) != -1 ); | |
656 | ||
657 | 681 | $self->{engine_version} = $self->{gecko_version}; |
658 | 682 | |
659 | 683 | if ( $ua =~ /trident\/([\w\.\d]*)/ ) { |
837 | 861 | $tests->{WIN2K3} = ( index( $ua, "nt 5.2" ) != -1 ); |
838 | 862 | $tests->{WINVISTA} = ( index( $ua, "nt 6.0" ) != -1 ); |
839 | 863 | $tests->{WIN7} = ( index( $ua, "nt 6.1" ) != -1 ); |
840 | $tests->{WIN8} = ( index( $ua, "nt 6.2" ) != -1 ); | |
864 | $tests->{WIN8_0} = ( index( $ua, "nt 6.2" ) != -1 ); | |
865 | $tests->{WIN8_1} = ( index( $ua, "nt 6.3" ) != -1 ); | |
866 | $tests->{WIN8} = ( $tests->{WIN8_0} || $tests->{WIN8_1} ); | |
841 | 867 | $tests->{DOTNET} = ( index( $ua, ".net clr" ) != -1 ); |
842 | 868 | |
843 | 869 | $tests->{WINME} = ( index( $ua, "win 9x 4.90" ) != -1 ); # whatever |
1049 | 1075 | return 'Win2k3' if $self->win2k3; |
1050 | 1076 | return 'WinVista' if $self->winvista; |
1051 | 1077 | return 'Win7' if $self->win7; |
1052 | return 'Win8' if $self->win8; | |
1078 | return 'Win8' if $self->win8_0; | |
1079 | return 'Win8.1' if $self->win8_1; | |
1053 | 1080 | return 'WinNT' if $self->winnt; |
1054 | 1081 | return 'Windows Phone' if $self->winphone; |
1055 | 1082 | return 'Win3x' if $self->win3x; |
1452 | 1479 | |
1453 | 1480 | =head1 VERSION |
1454 | 1481 | |
1455 | version 1.62 | |
1482 | version 1.64 | |
1456 | 1483 | |
1457 | 1484 | =head1 SYNOPSIS |
1458 | 1485 | |
1649 | 1676 | win32 |
1650 | 1677 | winme win95 win98 |
1651 | 1678 | winnt |
1652 | win2k winxp win2k3 winvista win7 win8 | |
1679 | win2k winxp win2k3 winvista win7 | |
1680 | win8 | |
1681 | win8_0 win8_1 | |
1653 | 1682 | wince |
1654 | 1683 | winphone |
1655 | 1684 | winphone7 winphone7_5 winphone8 |
1690 | 1719 | compatibility with the L<HTTP::Headers::UserAgent> module. |
1691 | 1720 | |
1692 | 1721 | Win95, Win98, WinNT, Win2K, WinXP, Win2k3, WinVista, Win7, Win8, |
1693 | Windows Phone, Mac, Mac OS X, iOS, Win3x, OS2, Unix, Linux, | |
1722 | Win8.1, Windows Phone, Mac, Mac OS X, iOS, Win3x, OS2, Unix, Linux, | |
1694 | 1723 | Firefox OS, Playstation 3 GameOS, Playstation Portable GameOS, |
1695 | 1724 | RIM Tablet OS |
1696 | 1725 | |
1714 | 1743 | |
1715 | 1744 | =head3 icab |
1716 | 1745 | |
1717 | =head3 ie ie3 ie4 ie4up ie5 ie55 ie6 ie7 ie8 ie9 ie10 | |
1746 | =head3 ie ie3 ie4 ie4up ie5 ie55 ie6 ie7 ie8 ie9 ie10 ie11 | |
1718 | 1747 | |
1719 | 1748 | =head3 java |
1720 | 1749 |
1101 | 1101 | "trident", |
1102 | 1102 | "win32", |
1103 | 1103 | "win8", |
1104 | "win8_0", | |
1104 | 1105 | "windows", |
1105 | 1106 | "winnt" |
1106 | 1107 | ], |
1120 | 1121 | "match" : [ |
1121 | 1122 | "windows", |
1122 | 1123 | "win8", |
1124 | "win8_0", | |
1123 | 1125 | "winnt", |
1124 | 1126 | "win32", |
1125 | 1127 | "trident", |
1138 | 1140 | "engine_minor" : "0", |
1139 | 1141 | "engine_version" : "6.0", |
1140 | 1142 | "engine_string" : "Trident" |
1143 | }, | |
1144 | "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko": { | |
1145 | "browser_string": "MSIE", | |
1146 | "major" : "11", | |
1147 | "match" : [ | |
1148 | "windows", | |
1149 | "win7", | |
1150 | "winnt", | |
1151 | "win32", | |
1152 | "trident", | |
1153 | "ie", | |
1154 | "ie11", | |
1155 | "ie55up", | |
1156 | "ie5up", | |
1157 | "ie4up" | |
1158 | ], | |
1159 | "minor" : "0", | |
1160 | "no_match" : null, | |
1161 | "os_string" : "Win7", | |
1162 | "other" : null, | |
1163 | "version" : "11.0", | |
1164 | "engine_major" : "7", | |
1165 | "engine_minor" : "0", | |
1166 | "engine_version" : "7.0", | |
1167 | "engine_string" : "Trident" | |
1168 | }, | |
1169 | "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko": { | |
1170 | "browser_string": "MSIE", | |
1171 | "major" : "11", | |
1172 | "match" : [ | |
1173 | "windows", | |
1174 | "win8", | |
1175 | "win8_1", | |
1176 | "winnt", | |
1177 | "win32", | |
1178 | "trident", | |
1179 | "ie", | |
1180 | "ie11", | |
1181 | "ie55up", | |
1182 | "ie5up", | |
1183 | "ie4up" | |
1184 | ], | |
1185 | "minor" : "0", | |
1186 | "no_match" : null, | |
1187 | "os_string" : "Win8.1", | |
1188 | "other" : null, | |
1189 | "version" : "11.0", | |
1190 | "engine_major" : "7", | |
1191 | "engine_minor" : "0", | |
1192 | "engine_version" : "7.0", | |
1193 | "engine_string" : "Trident" | |
1194 | }, | |
1195 | "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" : { | |
1196 | "browser_string" : "Opera", | |
1197 | "major" : "15", | |
1198 | "match" : [ | |
1199 | "windows", | |
1200 | "win7", | |
1201 | "winnt", | |
1202 | "win32", | |
1203 | "opera" | |
1204 | ], | |
1205 | "minor" : "0", | |
1206 | "no_match" : null, | |
1207 | "os_string" : "Win7", | |
1208 | "other" : null, | |
1209 | "version" : "15.0" | |
1141 | 1210 | }, |
1142 | 1211 | "Mozilla/4.0 (compatible; Opera/3.0; Windows 4.10) 3.50" : { |
1143 | 1212 | "browser_string" : "Opera", |