Codebase list libhttp-browserdetect-perl / ff19484
[svn-upgrade] new version libhttp-browserdetect-perl (1.18) Ansgar Burchardt 13 years ago
12 changed file(s) with 932 addition(s) and 35 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.17',
25 'dist_version' => '1.18',
2626 'license' => 'perl',
2727 'module_name' => 'HTTP::BrowserDetect',
2828 'recommends' => {},
00 Revision history for Perl extension HTTP::BrowserDetect.
1
2 1.18 2010-09-06
3 - Added support for Netfront and Safari on Kindle
14
25 1.17 2010-08-28
36 - Added support for Mobile Safari, Links and Elinks (Jon Jensen)
69 1.16 2010-08-19
710 - Added support for the < 3.0 Safari public versions (Jon Jensen)
811 - Added new UserAgents to useragents.yaml (Jon Jensen)
9
12
1013 1.15 2010-08-18
1114 - Re-releasing after some folders unintentionally included in build
1215
00
11 This is the Perl distribution HTTP-BrowserDetect.
22
3 Installing HTTP-BrowserDetect is straightforward.
3 ## Installation
44
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:
5 HTTP-BrowserDetect installation is straightforward.
6 If your CPAN shell is set up, you should just be able to do
197
208 % cpan HTTP::BrowserDetect
219
22 ## Manual installation
23
24 As a last resort, you can manually install it. Download the tarball, untar it,
25 then build it:
10 Download it, unpack it, then build it as per the usual:
2611
2712 % perl Makefile.PL
2813 % make && make test
3116
3217 % make install
3318
34 If you are installing into a system-wide directory, you may need to run:
35
36 % sudo make install
37
3819 ## Documentation
3920
40 HTTP-BrowserDetect documentation is available as POD.
41 You can run perldoc from a shell to read the documentation:
21 HTTP-BrowserDetect documentation is available as in POD.
22 So you can do:
4223
4324 % 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
1314 t/release-pod-coverage.t
1415 t/release-pod-syntax.t
1516 t/useragents.yaml
1212 ExtUtils::MakeMaker: 6.31
1313 Module::Build: 0.3601
1414 dynamic_config: 0
15 generated_by: 'Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101670'
15 generated_by: 'Dist::Zilla version 4.102221, CPAN::Meta::Converter version 2.102160'
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.17
27 version: 1.18
3030 'Exporter' => '0',
3131 'vars' => '0'
3232 },
33 'VERSION' => '1.17',
33 'VERSION' => '1.18',
3434 'test' => {
3535 'TESTS' => 't/*.t'
3636 }
22 an HTTP user agent string
33
44 VERSION
5 version 1.17
5 version 1.18
66
77 SYNOPSIS
88 use HTTP::BrowserDetect;
272272 iphone
273273 ipod
274274 ipad
275 kindle
275276 palm
276277 wap
277278 psp
22 license = Perl_5
33 copyright_holder = Lee Semel
44 copyright_year = 2010
5 version = 1.17
5 version = 1.18
66 main_module = lib/HTTP/BrowserDetect.pm
77
88 [MetaResources]
00 use strict;
11 package HTTP::BrowserDetect;
22 BEGIN {
3 $HTTP::BrowserDetect::VERSION = '1.17';
3 $HTTP::BrowserDetect::VERSION = '1.18';
44 }
55
66 use vars qw(@ISA @EXPORT @EXPORT_OK @ALL_TESTS);
3636 palm audrey iopener
3737 wap blackberry iphone
3838 ipod ipad ps3
39 psp
39 psp kindle
4040 );
4141
4242 # Browsers
225225 # Opera/9.80 (S60; SymbOS; Opera Mobi/320; U; sv) Presto/2.4.15 Version/10.00
226226
227227 if ( $ua =~ m{\AOpera.*\sVersion/(\d*)\.(\d*)\z}i) {
228 $major = $1;
229 $minor = $2;
230 }
231 elsif ( $ua =~ m{NetFront/(\d*)\.(\d*) Kindle}i ) {
228232 $major = $1;
229233 $minor = $2;
230234 }
439443 $tests->{NETFRONT} = (
440444 index( $ua, "playstation 3" ) != -1
441445 || index( $ua, "playstation portable" ) != -1
446 || index( $ua, "netfront" ) != -1
442447 );
443448
444449 # Devices
447452 $tests->{IPHONE} = ( index( $ua, "iphone" ) != -1 );
448453 $tests->{IPOD} = ( index( $ua, "ipod" ) != -1 );
449454 $tests->{IPAD} = ( index( $ua, "ipad" ) != -1 );
455 $tests->{KINDLE} = ( index( $ua, "kindle" ) != -1 );
450456 $tests->{AUDREY} = ( index( $ua, "audrey" ) != -1 );
451457 $tests->{IOPENER} = ( index( $ua, "i-opener" ) != -1 );
452458 $tests->{AVANTGO} = ( index( $ua, "avantgo" ) != -1 );
10711077
10721078 =head1 VERSION
10731079
1074 version 1.17
1080 version 1.18
10751081
10761082 =head1 SYNOPSIS
10771083
13971403
13981404 =head3 ipad
13991405
1406 =head3 kindle
1407
14001408 =head3 palm
14011409
14021410 =head3 wap
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";
1819 all_critic_ok();
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 );
21252125 - links
21262126 browser_string: Links
21272127 os: Linux
2128 ---
2129 useragent: 'Mozilla/4.0 (compatible; Linux 2.6.22) NetFront/3.4 Kindle/2.5 (screen 600x800; rotate)'
2130 match:
2131 - kindle
2132 - linux
2133 - netfront
2134 browser_string: NetFront
2135 os: linux
2136 public_version: 3.4
2137 public_major: 3
2138 public_minor: 0.4
2139 ---
2140 useragent: 'Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/3.0 (screen 600x800; rotate)'
2141 match:
2142 - kindle
2143 - linux
2144 - safari
2145 browser_string: Safari
2146 os: Linux
2147 public_version: 4.0
2148 public_major: 4
2149 public_minor: 0
2150