Codebase list libhttp-browserdetect-perl / b7d3910
Imported Upstream version 1.33 gregor herrmann 12 years ago
8 changed file(s) with 133 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
2626 "Olaf Alders <olaf\@wundercounter.com> (current maintainer)"
2727 ],
2828 "dist_name" => "HTTP-BrowserDetect",
29 "dist_version" => "1.32",
29 "dist_version" => "1.33",
3030 "license" => "perl",
3131 "module_name" => "HTTP::BrowserDetect",
3232 "recommends" => {},
00 Revision history for Perl extension HTTP::BrowserDetect.
1
2 1.33 2011-10-15
3 - Adds detections for the Trident engine (Douglas Christopher Wilson)
14
25 1.32 2011-10-12
36 - Fixes RealPlayer false positives (John Oatis)
5757 "web" : "http://github.com/oalders/http-browserdetect"
5858 }
5959 },
60 "version" : "1.32"
60 "version" : "1.33"
6161 }
6262
3333 "strict" => 0,
3434 "vars" => 0
3535 },
36 "VERSION" => "1.32",
36 "VERSION" => "1.33",
3737 "test" => {
3838 "TESTS" => "t/*.t"
3939 }
22 an HTTP user agent string
33
44 VERSION
5 version 1.32
5 version 1.33
66
77 SYNOPSIS
88 use HTTP::BrowserDetect;
161161 engine_string()
162162 Returns one of the following:
163163
164 Gecko, KHTML, MSIE, NetFront
165
166 Returns undef if no string can be found.
164 Gecko, KHTML, Trident, MSIE, NetFront
165
166 Returns "undef" if no string can be found.
167167
168168 engine_version()
169169 Returns the version number of the rendering engine. Currently this only
170 returns a version number for Gecko. Returns undef for all other engines.
170 returns a version number for Gecko and Trident. Returns "undef" for all
171 other engines.
171172
172173 engine_major()
173174 Returns the major version number of the rendering engine. Currently this
174 only returns a version number for Gecko. Returns undef for all other
175 engines.
175 only returns a version number for Gecko and Trident. Returns "undef" for
176 all other engines.
176177
177178 engine_minor()
178179 Returns the minor version number of the rendering engine. Currently this
179 only returns a version number for Gecko. Returns undef for all other
180 engines.
180 only returns a version number for Gecko and Trident. Returns "undef" for
181 all other engines.
181182
182183 Detecting OS Platform and Version
183184 The following methods are available, each returning a true or false
383384 John Oatis
384385
385386 TO DO
386 The _engine() method currently only handles Gecko. It needs to be
387 expanded to handle other rendering engines.
387 The "_engine()" method currently only handles Gecko and Trident. It
388 needs to be expanded to handle other rendering engines.
388389
389390 POD coverage is also not 100%.
390391
44 license = Perl_5
55 copyright_holder = Lee Semel
66 copyright_year = 2011
7 version = 1.32
7 version = 1.33
88 main_module = lib/HTTP/BrowserDetect.pm
99
1010 [GatherDir]
00 use strict;
11 package HTTP::BrowserDetect;
22 {
3 $HTTP::BrowserDetect::VERSION = '1.32';
3 $HTTP::BrowserDetect::VERSION = '1.33';
44 }
55
66 use vars qw(@ISA @EXPORT @EXPORT_OK @ALL_TESTS);
5959 aol3 aol4 aol5
6060 aol6 neoplanet neoplanet2
6161 avantgo emacs mozilla
62 gecko r1 elinks
63 netfront mobile_safari
62 r1 elinks netfront
63 mobile_safari
64 );
65
66 # Engines
67 push @ALL_TESTS, qw(
68 gecko trident
6469 );
6570
6671 # Firefox variants
697702 }
698703 }
699704
705 # Engines
706
707 $tests->{TRIDENT} = ( index( $ua, "trident/" ) != -1 );
708
709 $self->{engine_version} = $self->{gecko_version};
710
711 if ( $ua =~ /trident\/([\w\.\d]*)/ ) {
712 $self->{engine_version} = $1;
713 }
714
700715 # RealPlayer
701716 $tests->{REALPLAYER}
702717 = ( index( $ua, "(r1 " ) != -1 || index( $ua, "realplayer" ) != -1 );
931946 return 'Gecko';
932947 }
933948
949 if ( $self->trident ) {
950 return 'Trident';
951 }
952
934953 if ( $self->ie ) {
935954 return 'MSIE';
936955 }
946965
947966 my ( $self, $check ) = _self_or_default( @_ );
948967
949 if ( $self->gecko ) {
950 return $self->gecko_version;
951 }
952
953 return;
968 return $self->{engine_version};
954969
955970 }
956971
11331148
11341149 =head1 VERSION
11351150
1136 version 1.32
1151 version 1.33
11371152
11381153 =head1 SYNOPSIS
11391154
13061321
13071322 Returns one of the following:
13081323
1309 Gecko, KHTML, MSIE, NetFront
1310
1311 Returns undef if no string can be found.
1324 Gecko, KHTML, Trident, MSIE, NetFront
1325
1326 Returns C<undef> if no string can be found.
13121327
13131328 =head2 engine_version()
13141329
13151330 Returns the version number of the rendering engine. Currently this only
1316 returns a version number for Gecko. Returns undef for all other engines.
1331 returns a version number for Gecko and Trident. Returns C<undef> for all
1332 other engines.
13171333
13181334 =head2 engine_major()
13191335
13201336 Returns the major version number of the rendering engine. Currently this only
1321 returns a version number for Gecko. Returns undef for all other engines.
1337 returns a version number for Gecko and Trident. Returns C<undef> for all
1338 other engines.
13221339
13231340 =head2 engine_minor()
13241341
13251342 Returns the minor version number of the rendering engine. Currently this only
1326 returns a version number for Gecko. Returns undef for all other engines.
1343 returns a version number for Gecko and Trident. Returns C<undef> for all
1344 other engines.
13271345
13281346 =head1 Detecting OS Platform and Version
13291347
15971615
15981616 =head1 TO DO
15991617
1600 The _engine() method currently only handles Gecko. It needs to be expanded to
1601 handle other rendering engines.
1618 The C<_engine()> method currently only handles Gecko and Trident. It
1619 needs to be expanded to handle other rendering engines.
16021620
16031621 POD coverage is also not 100%.
16041622
359359 "winnt",
360360 "win32",
361361 "dotnet",
362 "trident",
362363 "ie",
363364 "ie8",
364365 "ie55up",
372373 "public_major" : "8",
373374 "public_minor" : "0",
374375 "public_version" : "8.0",
375 "version" : "8.0"
376 "version" : "8.0",
377 "engine_major" : "4",
378 "engine_minor" : "0",
379 "engine_version" : "4.0",
380 "engine_string" : "Trident"
376381 },
377382 "Mozilla/4.0 (PSP (PlayStation Portable); 2.00)" : {
378383 "device_name" : "Sony PlayStation Portable",
713718 "win32",
714719 "winnt",
715720 "dotnet",
721 "trident",
716722 "ie",
717723 "ie7",
718724 "ie4up",
723729 "minor" : "0",
724730 "no_match" : [
725731 "robot"
726 ]
732 ],
733 "engine_major" : "4",
734 "engine_minor" : "0",
735 "engine_version" : "4.0",
736 "engine_string" : "Trident"
727737 },
728738 "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; FunWebProducts; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; SeekmoToolbar 4.8.4)" : {
729739 "browser_string" : "MSIE",
826836 "winnt",
827837 "win32",
828838 "dotnet",
839 "trident",
829840 "ie",
830841 "ie4up",
831842 "ie55up",
835846 "os" : "WinXP",
836847 "public_major" : "8",
837848 "public_minor" : "0",
838 "public_version" : "8.0"
849 "public_version" : "8.0",
850 "engine_major" : "4",
851 "engine_minor" : "0",
852 "engine_version" : "4.0",
853 "engine_string" : "Trident"
839854 },
840855 "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NETi CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; InfoPath.3; .NET4.0C) chromeframe/4.0" : {
841856 "browser_string" : "MSIE",
846861 "winnt",
847862 "win32",
848863 "dotnet",
864 "trident",
849865 "ie",
850866 "ie8",
851867 "ie55up",
856872 "no_match" : null,
857873 "os" : "Win7",
858874 "other" : null,
859 "version" : "8.0"
875 "version" : "8.0",
876 "engine_major" : "4",
877 "engine_minor" : "0",
878 "engine_version" : "4.0",
879 "engine_string" : "Trident"
860880 },
861881 "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)": {
862882 "browser_string": "MSIE",
866886 "win7",
867887 "winnt",
868888 "win32",
889 "trident",
869890 "ie",
870891 "ie9",
871892 "ie55up",
876897 "no_match" : null,
877898 "os" : "Win7",
878899 "other" : null,
879 "version" : "9.0"
900 "version" : "9.0",
901 "engine_major" : "5",
902 "engine_minor" : "0",
903 "engine_version" : "5.0",
904 "engine_string" : "Trident"
880905 },
881906 "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)": {
882907 "browser_string": "MSIE",
886911 "win7",
887912 "winnt",
888913 "win32",
914 "trident",
889915 "ie",
890916 "ie10",
891917 "ie55up",
896922 "no_match" : null,
897923 "os" : "Win7",
898924 "other" : null,
899 "version" : "10.0"
925 "version" : "10.0",
926 "engine_major" : "6",
927 "engine_minor" : "0",
928 "engine_version" : "6.0",
929 "engine_string" : "Trident"
900930 },
901931 "Mozilla/4.0 (compatible; Opera/3.0; Windows 4.10) 3.50" : {
902932 "browser_string" : "Opera",
23352365 "RealPlayer SP, Windows 7: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; (R1 1.6))" : {
23362366 "browser_string" : "RealPlayer",
23372367 "country" : null,
2338 "engine_string" : "MSIE",
2368 "engine_string" : "Trident",
23392369 "language" : null,
23402370 "major" : null,
23412371 "match" : [
23452375 "win32",
23462376 "dotnet",
23472377 "realplayer",
2378 "trident",
23482379 "ie",
23492380 "ie7",
23502381 "ie55up",
26912722 "ie55up",
26922723 "ie5up",
26932724 "ie8",
2725 "trident",
26942726 "win32",
26952727 "windows",
26962728 "winnt",
26972729 "winxp"
26982730 ]
2731 },
2732 "Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; HTC; T7575)" : {
2733 "browser_string" : "MSIE",
2734 "language" : null,
2735 "match" : [
2736 "windows",
2737 "winphone",
2738 "mobile",
2739 "trident",
2740 "ie",
2741 "ie4up",
2742 "ie55up",
2743 "ie5up",
2744 "ie7"
2745 ],
2746 "os" : "WinPhone",
2747 "os_string" : "Windows Phone",
2748 "device_name" : "HTC T7575"
2749 },
2750 "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; HTC; T7575)" : {
2751 "browser_string": "MSIE",
2752 "language": null,
2753 "match" : [
2754 "windows",
2755 "winphone",
2756 "mobile",
2757 "trident",
2758 "ie",
2759 "ie4up",
2760 "ie55up",
2761 "ie5up",
2762 "ie9"
2763 ],
2764 "os" : "WinPhone",
2765 "os_string" : "Windows Phone",
2766 "device_name" : "HTC T7575"
26992767 },
27002768 "Mozilla/4.0 (compatible; MSIE 8.0; AOL 9.6; AOLBuild 4340.168; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; IE0006_ver1;EN_US)" : {
27012769 "browser_string" : "AOL Browser",
27022770 "major" : "8",
27032771 "minor" : "0",
27042772 "language" : "EN",
2705 "engine_string" : "MSIE",
2773 "engine_string" : "Trident",
27062774 "match" : [
27072775 "ie",
27082776 "ie4up",
27102778 "ie5up",
27112779 "ie8",
27122780 "aol",
2781 "trident",
27132782 "win32",
27142783 "windows",
27152784 "winnt",
27202789 },
27212790 "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Crossrider130)" : {
27222791 "browser_string" : "MSIE",
2723 "engine_string" : "MSIE",
2792 "engine_string" : "Trident",
27242793 "match" : [
27252794 "ie",
27262795 "ie4up",
27272796 "ie55up",
27282797 "ie5up",
27292798 "ie8",
2799 "trident",
27302800 "win32",
27312801 "windows",
27322802 "winnt",