Codebase list libhttp-browserdetect-perl / 2aa1e5d
Imported Upstream version 1.64 Angel Abad 10 years ago
9 changed file(s) with 179 addition(s) and 73 deletion(s). Raw diff Collapse all Expand all
1919 "Olaf Alders <olaf\@wundercounter.com> (current maintainer)"
2020 ],
2121 "dist_name" => "HTTP-BrowserDetect",
22 "dist_version" => "1.62",
22 "dist_version" => "1.64",
2323 "license" => "perl",
2424 "module_name" => "HTTP::BrowserDetect",
2525 "recommends" => {},
4242 );
4343
4444
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
4557 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;
5660 }
5761
5862 my $build = Module::Build->new(%module_build_args);
1515 * Olaf Alders <olaf@wundersolutions.com>
1616 * Olivier Bilodeau <olivier@bottomlesspit.org>
1717 * Paul Findlay <paul@findlay.net.nz>
18 * Robin Smidsrød <robin@smidsrod.no>
18 * Robin Smidsrød <robin@smidsrod.no>
1919 * Ronald J Kimball <rkimball@pangeamedia.com>
2020 * Surikov Alexey <surikov@alexey-pc.kiteventures.local>
2121 * Thom Blake <thom@odonnellpdc.com>
00 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)
18
29 1.62 2013-10-25 14:40:57 America/Toronto
310 - Returns explicit undef more consistently (David Ihnen)
55 "Olaf Alders <olaf@wundercounter.com> (current maintainer)"
66 ],
77 "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",
99 "license" : [
1010 "perl_5"
1111 ],
6262 "web" : "https://github.com/oalders/http-browserdetect"
6363 }
6464 },
65 "version" : "1.62",
65 "version" : "1.64",
6666 "x_contributors" : [
6767 "Aran Deltac <bluefeet@gmail.com>",
6868 "David Ihnen <davidihnen@gmail.com>",
3535 "Test::Most" => 0,
3636 "Test::NoWarnings" => 0
3737 },
38 "VERSION" => "1.62",
38 "VERSION" => "1.64",
3939 "test" => {
4040 "TESTS" => "t/*.t"
4141 }
4242 );
4343
4444
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
4560 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;
6964 }
7065
7166 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
22 an HTTP user agent string
33
44 VERSION
5 version 1.62
5 version 1.64
66
77 SYNOPSIS
88 use HTTP::BrowserDetect;
181181 win32
182182 winme win95 win98
183183 winnt
184 win2k winxp win2k3 winvista win7 win8
184 win2k winxp win2k3 winvista win7
185 win8
186 win8_0 win8_1
185187 wince
186188 winphone
187189 winphone7 winphone7_5 winphone8
211213 solely for compatibility with the HTTP::Headers::UserAgent module.
212214
213215 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,
215217 Firefox OS, Playstation 3 GameOS, Playstation Portable GameOS,
216218 RIM Tablet OS
217219
227229 firefox
228230 gecko
229231 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
231233 java
232234 konqueror
233235 lotusnotes
44 license = Perl_5
55 copyright_holder = Lee Semel
66 copyright_year = 2013
7 version = 1.62
7 version = 1.64
88 main_module = lib/HTTP/BrowserDetect.pm
99
1010 [GatherDir]
22
33 package HTTP::BrowserDetect;
44 {
5 $HTTP::BrowserDetect::VERSION = '1.62';
5 $HTTP::BrowserDetect::VERSION = '1.64';
66 }
77
88 use vars qw(@ALL_TESTS);
2121 win95 win98 winnt
2222 winme win32 win2k
2323 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
2727 );
2828
2929 # More precise Mac
8888 ie5 ie5up ie55
8989 ie55up ie6 ie7
9090 ie8 ie9 ie10
91 ie11
9192 );
9293
9394 our @OPERA_TESTS = qw(
277278
278279 my $ua = lc $self->{user_agent};
279280
281 # Trident Engine (detect early for sniffing out IE)
282 $tests->{TRIDENT} = ( index( $ua, "trident/" ) != -1 );
283
280284 # Browser version
281285 my ( $major, $minor, $beta ) = (
282286 $ua =~ m{
322326 ( $major, $minor, $beta ) = split /\./, $1;
323327
324328 }
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 );
325355
326356 # Opera needs to be dealt with specifically
327357 # http://dev.opera.com/articles/view/opera-ua-string-changes/
358 # http://my.opera.com/community/openweb/idopera/
328359 # 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
329361
330362 if ( $ua =~ m{\AOpera.*\sVersion/(\d*)\.(\d*)\z}i ) {
331363 $major = $1;
332364 $minor = $2;
333365 }
366 elsif ( $ua =~ m{\bOPR/(\d+)\.(\d+)}i ) {
367 $major = $1;
368 $minor = $2;
369 }
334370 elsif ( $ua =~ m{NetFront/(\d*)\.(\d*) Kindle}i ) {
335371 $major = $1;
336372 $minor = $2;
348384 $tests->{GECKO} = ( index( $ua, "gecko" ) != -1 )
349385 && ( index( $ua, "like gecko" ) == -1 );
350386
351 $tests->{CHROME} = ( index( $ua, "chrome/" ) != -1 );
387 $tests->{CHROME}
388 = ( !$tests->{OPERA}
389 && index( $ua, "chrome/" ) != -1 );
352390 $tests->{SAFARI}
353391 = ( ( index( $ua, "safari" ) != -1 )
354392 || ( index( $ua, "applewebkit" ) != -1 ) )
397435 = ( !$tests->{FIREFOX}
398436 && !$tests->{SAFARI}
399437 && !$tests->{CHROME}
438 && !$tests->{OPERA}
439 && !$tests->{TRIDENT}
400440 && index( $ua, "mozilla" ) != -1
401441 && index( $ua, "msie" ) == -1
402442 && index( $ua, "spoofer" ) == -1
403443 && index( $ua, "compatible" ) == -1
404 && index( $ua, "opera" ) == -1
405444 && index( $ua, "webtv" ) == -1
406445 && index( $ua, "hotjava" ) == -1
407446 && index( $ua, "nintendo" ) == -1
441480
442481 # Internet Explorer browsers
443482
444 $tests->{IE} = ( index( $ua, "msie" ) != -1
483 $tests->{IE} = ( $tests->{TRIDENT}
484 || index( $ua, "msie" ) != -1
445485 || index( $ua, 'microsoft internet explorer' ) != -1 );
446486 $tests->{IE3} = ( $tests->{IE} && $major == 3 );
447487 $tests->{IE4} = ( $tests->{IE} && $major == 4 );
456496 $tests->{IE8} = ( $tests->{IE} && $major == 8 );
457497 $tests->{IE9} = ( $tests->{IE} && $major == 9 );
458498 $tests->{IE10} = ( $tests->{IE} && $major == 10 );
499 $tests->{IE11} = ( $tests->{IE} && $major == 11 );
459500
460501 # Neoplanet browsers
461502
474515 $tests->{AOL6} = ( index( $ua, "aol 6.0" ) != -1 );
475516 $tests->{AOLTV} = ( index( $ua, "navio" ) != -1 )
476517 || ( 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 );
492518
493519 # Other browsers
494520
652678
653679 # Engines
654680
655 $tests->{TRIDENT} = ( index( $ua, "trident/" ) != -1 );
656
657681 $self->{engine_version} = $self->{gecko_version};
658682
659683 if ( $ua =~ /trident\/([\w\.\d]*)/ ) {
837861 $tests->{WIN2K3} = ( index( $ua, "nt 5.2" ) != -1 );
838862 $tests->{WINVISTA} = ( index( $ua, "nt 6.0" ) != -1 );
839863 $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} );
841867 $tests->{DOTNET} = ( index( $ua, ".net clr" ) != -1 );
842868
843869 $tests->{WINME} = ( index( $ua, "win 9x 4.90" ) != -1 ); # whatever
10491075 return 'Win2k3' if $self->win2k3;
10501076 return 'WinVista' if $self->winvista;
10511077 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;
10531080 return 'WinNT' if $self->winnt;
10541081 return 'Windows Phone' if $self->winphone;
10551082 return 'Win3x' if $self->win3x;
14521479
14531480 =head1 VERSION
14541481
1455 version 1.62
1482 version 1.64
14561483
14571484 =head1 SYNOPSIS
14581485
16491676 win32
16501677 winme win95 win98
16511678 winnt
1652 win2k winxp win2k3 winvista win7 win8
1679 win2k winxp win2k3 winvista win7
1680 win8
1681 win8_0 win8_1
16531682 wince
16541683 winphone
16551684 winphone7 winphone7_5 winphone8
16901719 compatibility with the L<HTTP::Headers::UserAgent> module.
16911720
16921721 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,
16941723 Firefox OS, Playstation 3 GameOS, Playstation Portable GameOS,
16951724 RIM Tablet OS
16961725
17141743
17151744 =head3 icab
17161745
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
17181747
17191748 =head3 java
17201749
11011101 "trident",
11021102 "win32",
11031103 "win8",
1104 "win8_0",
11041105 "windows",
11051106 "winnt"
11061107 ],
11201121 "match" : [
11211122 "windows",
11221123 "win8",
1124 "win8_0",
11231125 "winnt",
11241126 "win32",
11251127 "trident",
11381140 "engine_minor" : "0",
11391141 "engine_version" : "6.0",
11401142 "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"
11411210 },
11421211 "Mozilla/4.0 (compatible; Opera/3.0; Windows 4.10) 3.50" : {
11431212 "browser_string" : "Opera",