Codebase list libhttp-browserdetect-perl / 3031827
New upstream release. Gregor Herrmann 13 years ago
13 changed file(s) with 229 addition(s) and 938 deletion(s). Raw diff Collapse all Expand all
2222 'Olaf Alders <olaf@wundercounter.com> (current maintainer)'
2323 ],
2424 'dist_name' => 'HTTP-BrowserDetect',
25 'dist_version' => '1.16',
25 'dist_version' => '1.17',
2626 'license' => 'perl',
2727 'module_name' => 'HTTP::BrowserDetect',
2828 'recommends' => {},
00 Revision history for Perl extension HTTP::BrowserDetect.
1
2 1.17 2010-08-28
3 - Added support for Mobile Safari, Links and Elinks (Jon Jensen)
4 - Added more UserAgents to test suite (Jon Jensen)
15
26 1.16 2010-08-19
37 - Added support for the < 3.0 Safari public versions (Jon Jensen)
00
11 This is the Perl distribution HTTP-BrowserDetect.
22
3 ## Installation
3 Installing HTTP-BrowserDetect is straightforward.
44
5 HTTP-BrowserDetect installation is straightforward.
6 If your CPAN shell is set up, you should just be able to do
5 ## Installation with cpanm
6
7 If you have cpanm, you only need one line:
8
9 % cpanm HTTP::BrowserDetect
10
11 If you are installing into a system-wide directory, you may need to pass the
12 "-S" flag to cpanm, which uses sudo to install the module:
13
14 % cpanm -S HTTP::BrowserDetect
15
16 ## Installing with the CPAN shell
17
18 Alternatively, if your CPAN shell is set up, you should just be able to do:
719
820 % cpan HTTP::BrowserDetect
921
10 Download it, unpack it, then build it as per the usual:
22 ## Manual installation
23
24 As a last resort, you can manually install it. Download the tarball, untar it,
25 then build it:
1126
1227 % perl Makefile.PL
1328 % make && make test
1631
1732 % make install
1833
34 If you are installing into a system-wide directory, you may need to run:
35
36 % sudo make install
37
1938 ## Documentation
2039
21 HTTP-BrowserDetect documentation is available as in POD.
22 So you can do:
40 HTTP-BrowserDetect documentation is available as POD.
41 You can run perldoc from a shell to read the documentation:
2342
2443 % perldoc HTTP::BrowserDetect
25
26 to read the documentation with your favorite pager.
1010 lib/HTTP/BrowserDetect.pm
1111 t/01-detect.t
1212 t/author-critic.t
13 t/create_config.pl
1413 t/release-pod-coverage.t
1514 t/release-pod-syntax.t
1615 t/useragents.yaml
1212 ExtUtils::MakeMaker: 6.31
1313 Module::Build: 0.3601
1414 dynamic_config: 0
15 generated_by: 'Dist::Zilla version 4.102221, CPAN::Meta::Converter version 2.102160'
15 generated_by: 'Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101670'
1616 license: perl
1717 meta-spec:
1818 url: http://module-build.sourceforge.net/META-spec-v1.4.html
2424 resources:
2525 bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTTP-BrowserDetect
2626 repository: http://github.com/oalders/http-browserdetect
27 version: 1.16
27 version: 1.17
3030 'Exporter' => '0',
3131 'vars' => '0'
3232 },
33 'VERSION' => '1.16',
33 'VERSION' => '1.17',
3434 'test' => {
3535 'TESTS' => 't/*.t'
3636 }
22 an HTTP user agent string
33
44 VERSION
5 version 1.16
5 version 1.17
66
77 SYNOPSIS
88 use HTTP::BrowserDetect;
229229 aol aol3 aol4 aol5 aol6
230230 webtv
231231 opera opera3 opera4 opera5 opera6 opera7
232 lynx links
232 lynx links elinks
233233 emacs
234234 staroffice
235235 lotusnotes
239239 curl
240240 realplayer
241241 netfront
242 mobile_safari
242243 Netscape 6, even though its called six, in the User-Agent string has
243244 version number 5. The nav6 and nav6up methods correctly handle this
244245 quirk. The Firefox test correctly detects the older-named versions of
248249 Returns undef on failure. Otherwise returns one of the following:
249250
250251 Netscape, Firefox, Safari, Chrome, MSIE, WebTV, AOL Browser, Opera,
251 Mosaic, Lynx, RealPlayer, IceWeasel, curl, puf, NetFront
252 Mosaic, Lynx, Links, ELinks, RealPlayer, IceWeasel, curl, puf, NetFront,
253 Mobile Safari
252254
253255 gecko_version()
254256 If a Gecko rendering engine is used (as in Mozilla or Firefox), returns
0 libhttp-browserdetect-perl (1.17-1) UNRELEASED; urgency=low
1
2 * New upstream release.
3
4 -- gregor herrmann <gregoa@debian.org> Sat, 28 Aug 2010 16:14:23 +0200
5
06 libhttp-browserdetect-perl (1.16-1) unstable; urgency=low
17
28 [ Angel Abad ]
22 license = Perl_5
33 copyright_holder = Lee Semel
44 copyright_year = 2010
5 version = 1.16
5 version = 1.17
66 main_module = lib/HTTP/BrowserDetect.pm
77
88 [MetaResources]
1818 [ModuleBuild]
1919 [PodWeaver]
2020
21 [UploadToCPAN]
21 [UploadToCPAN]
00 use strict;
11 package HTTP::BrowserDetect;
22 BEGIN {
3 $HTTP::BrowserDetect::VERSION = '1.16';
3 $HTTP::BrowserDetect::VERSION = '1.17';
44 }
55
66 use vars qw(@ISA @EXPORT @EXPORT_OK @ALL_TESTS);
5656 aol5 aol6 neoplanet
5757 neoplanet2 avantgo emacs
5858 mozilla gecko r1
59 iceweasel netfront
59 iceweasel netfront mobile_safari
60 elinks
6061 );
6162
6263 # Robots
241242 = ( ( index( $ua, "safari" ) != -1 )
242243 || ( index( $ua, "applewebkit" ) != -1 ) )
243244 && ( index( $ua, "chrome" ) == -1 );
245 $tests->{MOBILE_SAFARI} = ($tests->{SAFARI} && index($ua, " mobile safari/") >= 0);
244246
245247 # Chrome Version
246248 if ( $tests->{CHROME} ) {
380382 $tests->{KONQUEROR} = ( index( $ua, "konqueror" ) != -1 );
381383 $tests->{LYNX} = ( index( $ua, "lynx" ) != -1 );
382384 $tests->{LINKS} = ( index( $ua, "links" ) != -1 );
385 $tests->{ELINKS} = ( index( $ua, "elinks" ) != -1 );
383386 $tests->{WEBTV} = ( index( $ua, "webtv" ) != -1 );
384387 $tests->{MOSAIC} = ( index( $ua, "mosaic" ) != -1 );
385388 $tests->{PUF} = ( index( $ua, "puf" ) != -1 );
699702 $browser_string = 'Opera' if $self->opera;
700703 $browser_string = 'Mosaic' if $self->mosaic;
701704 $browser_string = 'Lynx' if $self->lynx;
705 $browser_string = 'Links' if $self->links;
702706 $browser_string = 'RealPlayer' if $self->realplayer;
703707 $browser_string = 'IceWeasel' if $self->iceweasel;
704708 $browser_string = 'curl' if $self->curl;
705709 $browser_string = 'puf' if $self->puf;
706710 $browser_string = 'NetFront' if $self->netfront;
711 $browser_string = 'Mobile Safari' if $self->mobile_safari;
712 $browser_string = 'ELinks' if $self->elinks;
707713 }
708714 return $browser_string;
709715 }
10651071
10661072 =head1 VERSION
10671073
1068 version 1.16
1074 version 1.17
10691075
10701076 =head1 SYNOPSIS
10711077
13291335
13301336 =head3 opera opera3 opera4 opera5 opera6 opera7
13311337
1332 =head3 lynx links
1338 =head3 lynx links elinks
13331339
13341340 =head3 emacs
13351341
13481354 =head3 realplayer
13491355
13501356 =head3 netfront
1357
1358 =head3 mobile_safari
13511359
13521360 Netscape 6, even though its called six, in the User-Agent string has version
13531361 number 5. The nav6 and nav6up methods correctly handle this quirk. The Firefox
13591367 Returns undef on failure. Otherwise returns one of the following:
13601368
13611369 Netscape, Firefox, Safari, Chrome, MSIE, WebTV, AOL Browser, Opera, Mosaic,
1362 Lynx, RealPlayer, IceWeasel, curl, puf, NetFront
1370 Lynx, Links, ELinks, RealPlayer, IceWeasel, curl, puf, NetFront, Mobile Safari
13631371
13641372 =head2 gecko_version()
13651373
1515
1616 eval "use Test::Perl::Critic";
1717 plan skip_all => 'Test::Perl::Critic required to criticise code' if $@;
18 Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc";
1918 all_critic_ok();
+0
-877
t/create_config.pl less more
0 #!/usr/bin/perl
1
2 use strict;
3 use warnings;
4
5 use Data::Dump qw( dump );
6 use Test::More qw( no_plan );
7 require_ok('HTTP::BrowserDetect');
8
9 my @tests = (
10 [
11 "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.5) Gecko/20031007 Firebird/0.7",
12 "0.7",
13 0,
14 0.7,
15 "Firefox",
16 "WinXP",
17 "1.5",
18 ["windows", "win32", "winnt", "winxp", "firefox", "gecko"],
19 ],
20 [
21 "Mozilla/1.1 (Windows 3.0; I)",
22 "1.1",
23 1,
24 "0.1",
25 "Netscape",
26 "Win3x",
27 undef,
28 ["netscape", "windows", "win3x", "win16"],
29 ],
30 [
31 "Mozilla/1.1 (Windows 3.1; I)",
32 "1.1",
33 1,
34 "0.1",
35 "Netscape",
36 "Win3x",
37 undef,
38 ["netscape", "windows", "win31", "win3x", "win16"],
39 ],
40 [
41 "Mozilla/2.0 (Win95; I)",
42 "2.0",
43 2,
44 0,
45 "Netscape",
46 "Win95",
47 undef,
48 ["netscape", "nav2", "windows", "win32", "win95"],
49 ],
50 [
51 "Mozilla/2.0 (compatible; MSIE 3.01; Windows 95)",
52 "3.01",
53 3,
54 .01,
55 "MSIE",
56 "Win95",
57 undef,
58 ["ie", "ie3", "windows", "win32", "win95"],
59 ],
60 [
61 "Mozilla/2.0 (compatible; MSIE 3.01; Windows NT)",
62 "3.01",
63 3,
64 .01,
65 "MSIE",
66 "WinNT",
67 undef,
68 ["ie", "ie3", "windows", "win32", "winnt"],
69 ],
70 [
71 "Mozilla/2.0 (compatible; MSIE 3.0; AOL 3.0; Windows 95)",
72 "3",
73 3,
74 0,
75 "AOL Browser",
76 "Win95",
77 undef,
78 ["ie", "ie3", "windows", "win32", "win95", "aol", "aol3"],
79 ],
80 [
81 "Mozilla/2.0 (compatible; MSIE 4.0; Windows 95)",
82 "4",
83 4,
84 0,
85 "MSIE",
86 "Win95",
87 undef,
88 ["ie", "ie4", "ie4up", "windows", "win32", "win95"],
89 ],
90 [
91 "Mozilla/3.0 (compatible; MSIE 4.0; Windows 95)",
92 "4.0",
93 4,
94 0,
95 "MSIE",
96 "Win95",
97 undef,
98 ["ie", "ie4", "ie4up", "windows", "win32", "win95"],
99 ],
100 [
101 "Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)",
102 "4.01",
103 4,
104 0.01,
105 "MSIE",
106 "Win95",
107 undef,
108 ["ie", "ie4", "ie4up", "windows", "win32", "win95"],
109 ],
110 [
111 "Mozilla/4.0 (compatible; MSIE 5.0b2; Windows NT)",
112 "5.0",
113 5,
114 0,
115 "MSIE",
116 "WinNT",
117 undef,
118 ["ie", "ie5", "ie5up", "ie4up", "windows", "win32", "winnt"],
119 ],
120 [
121 "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)",
122 "5.5",
123 5,
124 0.5,
125 "MSIE",
126 "WinNT",
127 undef,
128 [
129 "ie",
130 "ie5",
131 "ie5up",
132 "ie55",
133 "ie55up",
134 "ie4up",
135 "windows",
136 "win32",
137 "winnt",
138 ],
139 ],
140 [
141 "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) via proxy gateway Something/1.23",
142 "5.5",
143 5,
144 0.5,
145 "MSIE",
146 "Win2k",
147 undef,
148 [
149 "ie",
150 "ie5",
151 "ie5up",
152 "ie55",
153 "ie55up",
154 "ie4up",
155 "windows",
156 "win32",
157 "winnt",
158 "win2k",
159 ],
160 ],
161 [
162 "Mozilla/3.0 (Macintosh; I; PPC)",
163 "3.0",
164 3,
165 0,
166 "Netscape",
167 "Mac",
168 undef,
169 ["netscape", "nav3", "mac", "macppc"],
170 ],
171 [
172 "Mozilla/4.0 (compatible; MSIE 5.0; Win32)",
173 "5.0",
174 5,
175 0,
176 "MSIE",
177 undef,
178 undef,
179 ["ie", "ie4up", "ie5", "ie5up", "windows", "win32"],
180 ],
181 [
182 "Mozilla/4.0 (compatible; Opera/3.0; Windows 4.10) 3.50",
183 "3.0",
184 3,
185 0,
186 "Opera",
187 undef,
188 undef,
189 ["opera", "opera3", "windows"],
190 ],
191 [
192 "Mozilla/4.0 (compatible; MSIE 5.0b1; Windows NT 5.0)",
193 "5.0",
194 5,
195 0,
196 "MSIE",
197 "Win2k",
198 undef,
199 [
200 "ie",
201 "ie4up",
202 "ie5",
203 "ie5up",
204 "windows",
205 "win32",
206 "winnt",
207 "win2k",
208 ],
209 ],
210 [
211 "Mozilla/4.06 [en] (Win98; I ;Nav)",
212 "4.06",
213 4,
214 0.06,
215 "Netscape",
216 "Win98",
217 undef,
218 ["netscape", "nav4", "nav4up", "windows", "win32", "win98"],
219 ],
220 [
221 "Mozilla/4.5 [en] (X11; I; FreeBSD 2.2.7-RELEASE i386)",
222 "4.5",
223 4,
224 0.5,
225 "Netscape",
226 "Unix",
227 undef,
228 [
229 "netscape",
230 "nav4",
231 "nav4up",
232 "nav45",
233 "nav45up",
234 "bsd",
235 "freebsd",
236 "unix",
237 "x11",
238 ],
239 ],
240 [
241 "Mozilla/3.03Gold (Win95; I)",
242 "3.03",
243 3,
244 0.03,
245 "Netscape",
246 "Win95",
247 undef,
248 ["netscape", "nav3", "navgold", "windows", "win32", "win95"],
249 ],
250 ["Wget/1.4.5", "1.4", 1, 0.4, undef, undef, undef, ["wget", "robot"]],
251 [
252 "libwww-perl/5.11",
253 "5.11",
254 5,
255 0.11,
256 undef,
257 undef,
258 undef,
259 ["lwp", "robot"],
260 ],
261 [
262 "GetRight/3.2.1",
263 "3.2",
264 3,
265 0.2,
266 undef,
267 undef,
268 undef,
269 ["getright", "robot"],
270 ],
271 [
272 "Mozilla/3.0 (compatible; StarOffice/5.1; Linux)",
273 "5.1",
274 5,
275 0.1,
276 undef,
277 "Linux",
278 undef,
279 ["linux", "unix", "staroffice"],
280 ],
281 [
282 "Mozilla/3.0 (compatible; StarOffice/5.1; Win32)",
283 "5.1",
284 5,
285 0.1,
286 undef,
287 undef,
288 undef,
289 ["win32", "windows", "staroffice"],
290 ],
291 [
292 "iCab/Pre2.0 (Macintosh; I; PPC)",
293 "2.0",
294 2,
295 0,
296 undef,
297 "Mac",
298 undef,
299 ["mac", "macppc", "icab"],
300 ],
301 [
302 "Konqueror/1.1.2",
303 "1.1",
304 1,
305 0.1,
306 undef,
307 undef,
308 undef,
309 [
310 "konqueror"
311 ],
312 [
313 "robot", # RT #30705
314 ],
315 ],
316 [
317 "Lotus-Notes/4.5 ( OS/2 )",
318 "4.5",
319 4,
320 0.5,
321 undef,
322 "OS2",
323 undef,
324 ["lotusnotes", "os2"],
325 ],
326 #["Java1.0.2", "0.0", 0, 0, undef, undef, undef, ["java"]],
327 [
328 "Googlebot/1.0 (googlebot\@googlebot.com http://googlebot.com/)",
329 "1.0",
330 1,
331 0,
332 undef,
333 undef,
334 undef,
335 ["google", "robot"],
336 ],
337 ["Nokia-WAP-Toolkit/1.3beta", "1.3", 1, 0.3, undef, undef, undef, ["wap"]],
338 ["Nokia7110/1.0 (30.05)", "1.0", 1, 0, undef, undef, undef, ["wap"]],
339 ["UP.Browser/4.1.2a-XXXX", "4.1", 4, 0.1, undef, undef, undef, ["wap"]],
340 ["Wapalizer/1.0", "1.0", 1, 0, undef, undef, undef, ["wap"]],
341 ["YourWap/1.16", "1.16", 1, 0.16, undef, undef, undef, ["wap"]],
342 [
343 "AmigaVoyager/3.3.50 (AmigaOS/PPC)",
344 "3.3",
345 3,
346 0.3,
347 undef,
348 undef,
349 undef,
350 ["amiga"],
351 ],
352 [
353 "fetch/1.0 FreeBSD/4.0-CURRENT (i386)",
354 "1.0",
355 1,
356 0,
357 undef,
358 "Unix",
359 undef,
360 ["bsd", "freebsd", "unix", "robot"],
361 ],
362 [
363 "Emacs-W3/2.1.105 URL/1.267 ((Unix?) ; TTY ; sparc-sun-solaris2.3)",
364 "2.1",
365 2,
366 0.1,
367 undef,
368 "Unix",
369 undef,
370 ["emacs", "sun", "unix"],
371 ],
372 [
373 "Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101",
374 "5.001",
375 5,
376 0.001,
377 "Netscape",
378 "WinNT",
379 undef,
380 [
381 "netscape",
382 "nav4up",
383 "nav45up",
384 "windows",
385 "winnt",
386 "win32",
387 "gecko",
388 "nav6",
389 "nav6up",
390 "mozilla",
391 "gecko",
392 ],
393 ],
394 [
395 "Mozilla/5.001 (Macintosh; N; PPC; ja) Gecko/25250101 MegaCorpBrowser/1.0 (MegaCorp, Inc.)",
396 "5.001",
397 5,
398 0.001,
399 "Netscape",
400 "Mac",
401 undef,
402 [
403 "netscape",
404 "nav4up",
405 "nav45up",
406 "nav6",
407 "nav6up",
408 "mac",
409 "macppc",
410 "mozilla",
411 "gecko",
412 ],
413 ],
414 [
415 "Mozilla/9.876 (X11; U; Linux 2.2.12-20 i686, en) Gecko/25250101 Netscape/5.432b1 (C-MindSpring)",
416 "5.432",
417 5,
418 0.432,
419 "Netscape",
420 "Linux",
421 undef,
422 [
423 "netscape",
424 "nav4up",
425 "nav45up",
426 "nav6",
427 "nav6up",
428 "linux",
429 "unix",
430 "mozilla",
431 "gecko",
432 "x11",
433 ],
434 ],
435 [
436 "TinyBrowser/2.0 (TinyBrowser Comment) Gecko/20201231",
437 "2.0",
438 2,
439 0,
440 undef,
441 undef,
442 undef,
443 ["gecko"],
444 ],
445 [
446 "TinyBrowser/2.0 (TinyBrowser Comment) Gecko/20201231",
447 "2.000",
448 2,
449 0,
450 undef,
451 undef,
452 undef,
453 ["gecko"],
454 ],
455 [
456 "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7) Gecko/20040619 Firefox/0.9",
457 "0.9",
458 0,
459 0.9,
460 "Firefox",
461 "Unix",
462 "1.7",
463 ["unix", "freebsd", "bsd", "x11", "firefox", "gecko"],
464 ],
465 [
466 "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040614 Firefox/0.9",
467 "0.9",
468 0,
469 0.9,
470 "Firefox",
471 "WinXP",
472 "1.7",
473 ["windows", "win32", "winnt", "winxp", "firefox", "gecko"],
474 ],
475 [
476 "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a) Gecko/20040416 Firefox/0.8.0+",
477 "0.8",
478 0,
479 0.8,
480 "Firefox",
481 "Win2k",
482 "1.8a",
483 ["windows", "win32", "winnt", "win2k", "firefox", "gecko"],
484 ],
485 [
486 "Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.6) Gecko/20040207 Firefox/0.8",
487 "0.8",
488 0,
489 0.8,
490 "Firefox",
491 "Linux",
492 "1.6",
493 ["unix", "linux", "x11", "firefox", "gecko"],
494 ],
495 [
496 "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20031002 Mozilla Firebird/0.6.1",
497 "0.6",
498 0,
499 0.6,
500 "Firefox",
501 "Linux",
502 "1.5a",
503 ["unix", "linux", "x11", "firefox", "gecko"],
504 ],
505 [
506 "Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5",
507 "0.5",
508 0,
509 0.5,
510 "Firefox",
511 "WinNT",
512 "1.3a",
513 ["windows", "win32", "winnt", "firefox", "gecko"],
514 ],
515 [
516 "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; OfficeLive",
517 "7.0",
518 7,
519 0,
520 "MSIE",
521 "WinVista",
522 undef,
523 [
524 "windows",
525 "win32",
526 "winnt",
527 "winvista",
528 "dotnet",
529 "ie",
530 "ie7",
531 "ie4up",
532 "ie5up",
533 "ie55up",
534 ],
535 ],
536 [
537 "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5",
538 "2.0",
539 2,
540 0,
541 "Chrome",
542 "WinVista",
543 undef,
544 [
545 "windows",
546 "win32",
547 "winnt",
548 "winvista",
549 "chrome",
550 ],
551 [
552 "safari",
553 "gecko",
554 ],
555 ],
556 # RT #48727
557 [
558 "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2 Safari/530.19.1",
559 "4.0",
560 4,
561 0,
562 "Safari",
563 "WinVista",
564 undef,
565 [
566 "windows",
567 "win32",
568 "winnt",
569 "winvista",
570 "safari",
571 ],
572 [
573 "gecko",
574 ],
575 ],
576 [
577 "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/124 (KHTML, like Gecko) Safari/125.1",
578 "1.25",
579 1,
580 0.25,
581 "Safari",
582 "Mac OS X",
583 undef,
584 [
585 "mac",
586 "macosx",
587 "macppc",
588 "safari",
589 ],
590 [
591 "gecko",
592 ],
593 ],
594 [
595 "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/106.2 (KHTML, like Gecko) Safari/100.1",
596 "1.0",
597 1,
598 0,
599 "Safari",
600 "Mac OS X",
601 undef,
602 [
603 "mac",
604 "macosx",
605 "macppc",
606 "safari",
607 ],
608 [
609 "gecko",
610 ],
611 ],
612 [
613 "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74",
614 "0.74",
615 0,
616 0.74,
617 "Safari",
618 "Mac OS X",
619 undef,
620 [
621 "mac",
622 "macosx",
623 "macppc",
624 "safari",
625 ],
626 [
627 "gecko",
628 ],
629 ],
630 [
631 "BlackBerry7730/3.7.1 UP.Link/5.1.2.5",
632 "3.7",
633 3,
634 0.7,
635 undef,
636 undef,
637 undef,
638 ["blackberry"],
639 ],
640 [
641 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)",
642 "6.0",
643 6,
644 0,
645 "MSIE",
646 "Win2k",
647 undef,
648 [
649 "windows",
650 "winnt",
651 "win2k",
652 "win32",
653 "ie",
654 "ie4up",
655 "ie5up",
656 "ie55up",
657 "ie6",
658 "dotnet",
659 ],
660 ],
661 [
662 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",
663 "6.0",
664 6,
665 0,
666 "MSIE",
667 "WinXP",
668 undef,
669 [
670 "windows",
671 "winnt",
672 "winxp",
673 "win32",
674 "ie",
675 "ie4up",
676 "ie5up",
677 "ie55up",
678 "ie6",
679 ],
680 ],
681 [
682 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)",
683 "6.0",
684 6,
685 0,
686 "MSIE",
687 "WinXP",
688 undef,
689 [
690 "windows",
691 "winnt",
692 "winxp",
693 "win32",
694 "ie",
695 "ie4up",
696 "ie5up",
697 "ie55up",
698 "ie6",
699 "dotnet",
700 ],
701 ],
702 [
703 "Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC) ",
704 "5.22",
705 5,
706 0.22,
707 "MSIE",
708 "Mac",
709 undef,
710 ["mac", "macppc", "ie", "ie4up", "ie5", "ie5up"],
711 ],
712 [
713 "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02",
714 "7.02",
715 7,
716 0.02,
717 "Netscape",
718 "Mac OS X",
719 "1.0.2",
720 [
721 "mac",
722 "macppc",
723 "netscape",
724 "nav4up",
725 "nav45up",
726 "nav6up",
727 "gecko",
728 "macosx",
729 "mozilla",
730 ],
731 ],
732 [
733 "Mozilla/5.0 (X11; U; Linux 2.4.3-20mdk i586; en-US; rv:0.9.1) Gecko/20010611",
734 "5",
735 5,
736 0,
737 "Netscape",
738 "Linux",
739 "0.9.1",
740 [
741 "linux",
742 "netscape",
743 "nav4up",
744 "nav45up",
745 "nav6",
746 "nav6up",
747 "unix",
748 "x11",
749 "gecko",
750 "mozilla",
751 ],
752 ],
753 [
754 "Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413 UP.Link/6.3.1.15.0",
755 4.13,
756 4,
757 0.13,
758 "Safari",
759 undef,
760 undef,
761 [
762 "safari",
763 ],
764 [
765 "gecko",
766 ],
767 ],
768 [
769 "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008062901 IceWeasel/3.0",
770 3.0,
771 3,
772 0,
773 "Iceweasel",
774 undef,
775 undef,
776 ["windows", "win32", "winnt", "winxp", "firefox", "gecko",],
777 ],
778 [
779 "libcurl-agent/1.0",
780 1,
781 1,
782 0,
783 "curl",
784 undef,
785 undef,
786 ["curl"],
787 ],
788 [
789 "puf/0.93.2a (Linux 2.4.20-19.9; i686)",
790 0.93,
791 0,
792 0.93,
793 "puf",
794 undef,
795 undef,
796 ["puf","robot",],
797 ["mobile",],
798 ],
799 [
800 "Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0_2 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5C1 Safari/525.20",
801 undef,
802 undef,
803 undef,
804 "safari",
805 undef,
806 undef,
807 ["safari", "mobile"],
808 ],
809 # test for uninitialized value warnings RT #8547
810 [
811 "Internetf Explorer 6 (MSIE 6; Windows XP)",
812 ],
813 # test for uninitialized value warnings RT #8547
814 [
815 "Links (2.1pre15; Linux 2.4.26-vc4 i586; x)",
816 ],
817
818 # These tests all have issues with returning undef rather than 0 for
819 # version numbers. Need to explore this to see what the correct behaviour
820 # should be
821
822 #[
823 # "AmigaVoyager (compatible; AmigaVoyager; AmigaOS)",
824 # "0.0",
825 # 0,
826 # 0,
827 # undef,
828 # undef,
829 # undef,
830 # ["amiga"],
831 #],
832 #[
833 # "AvantGo 3.2 (compatible; AvantGo 3.2)",
834 # "0.0",
835 # 0,
836 # 0,
837 # undef,
838 # undef,
839 # undef,
840 # ["palm", "avantgo"],
841 #],
842 #["Nothing", undef, undef, 0, undef, undef, undef, [""]], # does this make sense?
843 #[undef, "0.0", 0, 0, undef, undef, undef, [""]],
844 );
845
846
847 use YAML::Tiny qw( Dump DumpFile );
848
849 my $string = Dump( @tests );
850 #print $string;
851
852 my @yaml = ( );
853
854 foreach my $test ( @tests ) {
855 my ( $ua, $version, $major, $minor, $browser, $os, $other, $match, $no_match ) = @{$test};
856 my $desc = {
857 useragent => $ua,
858 version => $version,
859 major => $major,
860 minor => $minor,
861 browser => $browser,
862 os => $os,
863 other => $other,
864 match => $match,
865 no_match => $no_match,
866 };
867
868 push @yaml, $desc;
869
870 }
871
872 my $yaml = Dump ( @yaml );
873
874 print $yaml;
875
876 DumpFile( 'useragents.yaml', @yaml );
11101110 device: iphone
11111111 device_name: iPhone
11121112 ---
1113 browser_string: ~
1114 major: ~
1115 match: ~
1116 minor: ~
1117 no_match: ~
1118 os: ~
1119 other: ~
1120 useragent: 'Internetf Explorer 6 (MSIE 6; Windows XP)'
1121 version: ~
1122 language: ~
1123 country: ~
1124 ---
1125 browser_string: ~
1126 major: ~
1127 match: ~
1128 minor: ~
1129 no_match: ~
1130 os: ~
1131 other: ~
11321113 useragent: 'Links (2.1pre15; Linux 2.4.26-vc4 i586; x)'
1133 version: ~
1134 language: ~
1135 country: ~
1114 match:
1115 - linux
1116 - unix
1117 - links
1118 browser_string: Links
1119 os: Linux
11361120 ---
11371121 browser_string: MSIE
11381122 major: 8
12461230 language: ~
12471231 country: ~
12481232 engine_string: MSIE
1249 #---
1250 #browser_string: Netscape
1251 #major: 6
1252 #match:
1253 # - windows
1254 # - safari
1255 #minor: 0.1
1256 #no_match: ~
1257 #os: Win98
1258 #other: ~
1259 #useragent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.12.1 (KHTML, like Gecko) Version/3.0.1 Safari/522.12.2
1260 #version: 6.1
1261 #language: EN
1262 #country: ~
1233 ---
1234 useragent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.12.1 (KHTML, like Gecko) Version/3.0.1 Safari/522.12.2
1235 match:
1236 - windows
1237 - winxp
1238 - safari
1239 browser_string: Safari
1240 os: WinXP
1241 public_version: 3.0
1242 public_major: 3.0
1243 public_minor: 0
1244 engine_string: KHTML
1245 language: EN
12631246 ---
12641247 browser_string: Safari
12651248 match:
18241807 useragent: 'Mozilla/5.0 (Linux; U; Android 1.5; en-us; Google Ion Build/CRB43) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1'
18251808 match:
18261809 - safari
1810 - mobile_safari
18271811 - mobile
18281812 - linux
18291813 - android
1830 browser_string: Safari
1814 browser_string: Mobile Safari
18311815 public_version: 3.1
18321816 public_major: 3
18331817 public_minor: 0.1
19921976 engine_version: 1.8
19931977 engine_major: 1
19941978 engine_minor: 0.8
1979 ---
1980 useragent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.6 (KHTML, like Gecko) Chrome/7.0.503.1 Safari/534.6'
1981 match:
1982 - linux
1983 - unix
1984 - x11
1985 - chrome
1986 browser_string: Chrome
1987 os: Linux
1988 public_version: 7.0
1989 public_major: 7
1990 public_minor: 0
1991 engine_string: KHTML
1992 ---
1993 useragent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4'
1994 match:
1995 - linux
1996 - unix
1997 - x11
1998 - chrome
1999 browser_string: Chrome
2000 os: Linux
2001 public_version: 5.0
2002 public_major: 5
2003 public_minor: 0
2004 engine_string: KHTML
2005 ---
2006 useragent: 'Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.14427/19.916; U; en) Presto/2.5.25'
2007 match:
2008 - opera
2009 browser_string: Opera
2010 public_version: 9.80
2011 public_major: 9
2012 public_minor: 0.80
2013 language: EN
2014 ---
2015 useragent: 'Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; DROIDX Build/VZW) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17 854X480 motorola DROIDX'
2016 match:
2017 - safari
2018 - mobile_safari
2019 - mobile
2020 - linux
2021 - android
2022 browser_string: Mobile Safari
2023 public_version: 4.0
2024 public_major: 4
2025 public_minor: 0
2026 version: 5.30
2027 major: 5
2028 minor: 0.30
2029 engine: 5.30
2030 engine_string: KHTML
2031 language: EN
2032 country: US
2033 ---
2034 useragent: 'Mozilla/5.0 (Linux; U; Android 1.5; en-us; Google Ion Build/CRB43) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1'
2035 match:
2036 - safari
2037 - mobile_safari
2038 - mobile
2039 - linux
2040 - android
2041 browser_string: Mobile Safari
2042 public_version: 3.1
2043 public_major: 3
2044 public_minor: 0.1
2045 version: 5.25
2046 major: 5
2047 minor: 0.25
2048 engine: 5.25
2049 engine_string: KHTML
2050 language: EN
2051 country: US
2052 ---
2053 useragent: 'Opera/9.80 (Android; Opera Mini/5.1.21126/19.916; U; en) Presto/2.5.25'
2054 match:
2055 - opera
2056 - android
2057 browser_string: Opera
2058 os: Android
2059 public_version: 9.80
2060 public_major: 9
2061 public_minor: 0.80
2062 language: EN
2063 ---
2064 useragent: 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'
2065 match:
2066 - windows
2067 - winnt
2068 - winxp
2069 - win32
2070 - ie
2071 - ie4up
2072 - ie5up
2073 - ie55up
2074 - ie6
2075 browser_string: MSIE
2076 os: WinXP
2077 public_version: 6.0
2078 public_major: 6
2079 public_minor: 0
2080 ---
2081 useragent: 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.18) Gecko/2010021718 CentOS/3.0.18-1.el5.centos Firefox/3.0.18'
2082 match:
2083 - linux
2084 - unix
2085 - x11
2086 - firefox
2087 browser_string: Firefox
2088 os: Linux
2089 public_version: 3.0
2090 public_major: 3
2091 public_minor: 0
2092 engine_string: Gecko
2093 engine_version: 1.9
2094 engine_major: 1
2095 engine_minor: 0.9
2096 ---
2097 useragent: 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100403 Fedora/3.6.3-4.fc13 Firefox/3.6.3'
2098 match:
2099 - linux
2100 - unix
2101 - x11
2102 - firefox
2103 browser_string: Firefox
2104 os: Linux
2105 public_version: 3.6
2106 public_major: 3
2107 public_minor: 0.6
2108 engine_string: Gecko
2109 engine_version: 1.9
2110 engine_major: 1
2111 engine_minor: 0.9
2112 ---
2113 useragent: 'ELinks/0.12~pre5-2ubuntu1 (textmode; Ubuntu; Linux 2.6.32-24-generic x86_64; 135x85-2)'
2114 match:
2115 - linux
2116 - unix
2117 - elinks
2118 browser_string: ELinks
2119 os: Linux
2120 ---
2121 useragent: 'Links (2.2; Linux 2.6.32-24-generic x86_64; 135x85)'
2122 match:
2123 - linux
2124 - unix
2125 - links
2126 browser_string: Links
2127 os: Linux