Codebase list libhttp-browserdetect-perl / upstream/2.08
Imported Upstream version 2.08 gregor herrmann 8 years ago
13 changed file(s) with 107 addition(s) and 827 deletion(s). Raw diff Collapse all Expand all
00
1 # This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.041.
1 # This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.043.
22 use strict;
33 use warnings;
44
2020 "Olaf Alders <olaf\@wundercounter.com> (current maintainer)"
2121 ],
2222 "dist_name" => "HTTP-BrowserDetect",
23 "dist_version" => "2.07",
23 "dist_version" => "2.08",
2424 "license" => "perl",
2525 "module_name" => "HTTP::BrowserDetect",
2626 "recursive_test_files" => 1,
2727 "requires" => {
28 "JSON::PP" => "2.27300",
2829 "perl" => "5.006",
2930 "strict" => 0,
3031 "vars" => 0,
3233 },
3334 "test_requires" => {
3435 "FindBin" => 0,
35 "JSON::PP" => 0,
36 "JSON::PP" => "2.27300",
3637 "Path::Tiny" => 0,
3738 "Test::FailWarnings" => 0,
3839 "Test::More" => 0,
4445
4546 my %fallback_build_requires = (
4647 "FindBin" => 0,
47 "JSON::PP" => 0,
48 "JSON::PP" => "2.27300",
4849 "Module::Build" => "0.28",
4950 "Path::Tiny" => 0,
5051 "Test::FailWarnings" => 0,
2020 * lsaunders
2121 * Marco Fontani
2222 * Maros Kollar
23 * Nicolas Doye
2324 * Olaf Alders
2425 * Olivier Bilodeau
2526 * Paul Findlay
00 Revision history for Perl extension HTTP::BrowserDetect.
1
2 2.08 2016-01-29 21:56:29 America/Toronto
3 - Brave browser detection added (Nicolas Doye)
14
25 2.07 2015-11-18 23:52:07 America/Toronto
36 - Strip off anything Google Translate adds to UserAgent before parsing
0 This software is copyright (c) 2015 by Lee Semel.
0 This software is copyright (c) 2016 by Lee Semel.
11
22 This is free software; you can redistribute it and/or modify it under
33 the same terms as the Perl 5 programming language system itself.
1111
1212 --- The GNU General Public License, Version 1, February 1989 ---
1313
14 This software is Copyright (c) 2015 by Lee Semel.
14 This software is Copyright (c) 2016 by Lee Semel.
1515
1616 This is free software, licensed under:
1717
271271
272272 --- The Artistic License 1.0 ---
273273
274 This software is Copyright (c) 2015 by Lee Semel.
274 This software is Copyright (c) 2016 by Lee Semel.
275275
276276 This is free software, licensed under:
277277
0 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.041.
0 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.043.
11 Build.PL
22 CONTRIBUTORS
33 Changes
77 META.json
88 META.yml
99 Makefile.PL
10 README
1110 TODO
1211 cpanfile
1312 dist.ini
55 "Olaf Alders <olaf@wundercounter.com> (current maintainer)"
66 ],
77 "dynamic_config" : 0,
8 "generated_by" : "Dist::Zilla version 5.041, CPAN::Meta::Converter version 2.150005",
8 "generated_by" : "Dist::Zilla version 5.043, CPAN::Meta::Converter version 2.150005",
99 "license" : [
1010 "perl_5"
1111 ],
3636 },
3737 "runtime" : {
3838 "requires" : {
39 "JSON::PP" : "2.27300",
3940 "perl" : "5.006",
4041 "strict" : "0",
4142 "vars" : "0",
4546 "test" : {
4647 "requires" : {
4748 "FindBin" : "0",
48 "JSON::PP" : "0",
49 "JSON::PP" : "2.27300",
4950 "Path::Tiny" : "0",
5051 "Test::FailWarnings" : "0",
5152 "Test::More" : "0",
6667 "web" : "https://github.com/oalders/http-browserdetect"
6768 }
6869 },
69 "version" : "2.07",
70 "version" : "2.08",
7071 "x_contributors" : [
7172 "Andrew Moise <andrew.moise@gmail.com>",
7273 "Aran Deltac <bluefeet@gmail.com>",
8384 "lsaunders <lsaunders@dev05.backbone.i5invest.com>",
8485 "Marco Fontani <MFONTANI@cpan.org>",
8586 "Maros Kollar <maros@k-1.com>",
87 "Nicolas Doye <nic@worldofnic.org>",
8688 "Olaf Alders <olaf@wundersolutions.com>",
8789 "Olivier Bilodeau <olivier@bottomlesspit.org>",
8890 "Paul Findlay <paul@findlay.net.nz>",
55 - 'Olaf Alders <olaf@wundercounter.com> (current maintainer)'
66 build_requires:
77 FindBin: '0'
8 JSON::PP: '0'
8 JSON::PP: '2.27300'
99 Module::Build: '0.28'
1010 Path::Tiny: '0'
1111 Test::FailWarnings: '0'
1616 ExtUtils::MakeMaker: '0'
1717 Module::Build: '0.28'
1818 dynamic_config: 0
19 generated_by: 'Dist::Zilla version 5.041, CPAN::Meta::Converter version 2.150005'
19 generated_by: 'Dist::Zilla version 5.043, CPAN::Meta::Converter version 2.150005'
2020 license: perl
2121 meta-spec:
2222 url: http://module-build.sourceforge.net/META-spec-v1.4.html
2323 version: '1.4'
2424 name: HTTP-BrowserDetect
2525 requires:
26 JSON::PP: '2.27300'
2627 perl: '5.006'
2728 strict: '0'
2829 vars: '0'
3132 bugtracker: http://github.com/oalders/HTTP-BrowserDetect/issues
3233 homepage: https://metacpan.org/release/HTTP-BrowserDetect
3334 repository: https://github.com/oalders/http-browserdetect.git
34 version: '2.07'
35 version: '2.08'
3536 x_contributors:
3637 - 'Andrew Moise <andrew.moise@gmail.com>'
3738 - 'Aran Deltac <bluefeet@gmail.com>'
4849 - 'lsaunders <lsaunders@dev05.backbone.i5invest.com>'
4950 - 'Marco Fontani <MFONTANI@cpan.org>'
5051 - 'Maros Kollar <maros@k-1.com>'
52 - 'Nicolas Doye <nic@worldofnic.org>'
5153 - 'Olaf Alders <olaf@wundersolutions.com>'
5254 - 'Olivier Bilodeau <olivier@bottomlesspit.org>'
5355 - 'Paul Findlay <paul@findlay.net.nz>'
0 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.041.
0 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.043.
11 use strict;
22 use warnings;
33
2020 "MIN_PERL_VERSION" => "5.006",
2121 "NAME" => "HTTP::BrowserDetect",
2222 "PREREQ_PM" => {
23 "JSON::PP" => "2.27300",
2324 "strict" => 0,
2425 "vars" => 0,
2526 "warnings" => 0
2627 },
2728 "TEST_REQUIRES" => {
2829 "FindBin" => 0,
29 "JSON::PP" => 0,
30 "JSON::PP" => "2.27300",
3031 "Path::Tiny" => 0,
3132 "Test::FailWarnings" => 0,
3233 "Test::More" => 0,
3334 "Test::Most" => 0,
3435 "Test::NoWarnings" => 0
3536 },
36 "VERSION" => "2.07",
37 "VERSION" => "2.08",
3738 "test" => {
3839 "TESTS" => "t/*.t"
3940 }
4243
4344 my %FallbackPrereqs = (
4445 "FindBin" => 0,
45 "JSON::PP" => 0,
46 "JSON::PP" => "2.27300",
4647 "Module::Build" => "0.28",
4748 "Path::Tiny" => 0,
4849 "Test::FailWarnings" => 0,
+0
-800
README less more
0 SYNOPSIS
1
2 use HTTP::BrowserDetect;
3
4 my $ua = HTTP::BrowserDetect->new($user_agent_string);
5
6 # Print general information
7 print "Browser: $ua->browser_string\n"
8 if $ua->browser_string;
9 print "Version: $ua->browser_version$ua->browser_beta\n"
10 if $ua->browser_version;
11 print "OS: $ua->os_string\n"
12 if $ua->os_string;
13
14 # Detect operating system
15 if ($ua->windows) {
16 if ($ua->winnt) ...
17 if ($ua->win95) ...
18 }
19 print "Mac\n" if $ua->macosx;
20
21 # Detect browser vendor and version
22 print "Safari\n" if $ua->safari;
23 print "MSIE\n" if $ua->ie;
24 print "Mobile\n" if $ua->mobile;
25 if ($ua->browser_major(4)) {
26 if ($ua->browser_minor() > .5) {
27 ...
28 }
29 }
30 if ($ua->browser_version() > 4.5) {
31 ...;
32 }
33
34 DESCRIPTION
35
36 The HTTP::BrowserDetect object does a number of tests on an HTTP user
37 agent string. The results of these tests are available via methods of
38 the object.
39
40 This module was originally based upon the JavaScript browser detection
41 code available at
42 http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html.
43
44 CONSTRUCTOR AND STARTUP
45
46 new()
47
48 HTTP::BrowserDetect->new( $user_agent_string )
49
50 The constructor may be called with a user agent string specified.
51 Otherwise, it will use the value specified by $ENV{'HTTP_USER_AGENT'},
52 which is set by the web server when calling a CGI script.
53
54 SUBROUTINES/METHODS
55
56 Browser Information
57
58 browser()
59
60 Returns the browser, as one of the following values:
61
62 chrome, firefox, ie, opera, safari, applecoremedia, blackberry,
63 browsex, dalvik, elinks, links, lynx, emacs, epiphany, galeon,
64 konqueror, icab, lotusnotes, mosaic, mozilla, netfront, netscape, n3ds,
65 dsi, obigo, realplayer, seamonkey, silk, staroffice, ucbrowser, webtv
66
67 If the browser could not be identified (either because unrecognized or
68 because it is a robot), returns undef.
69
70 browser_string()
71
72 Returns a human formatted version of the browser name. These names are
73 subject to change and are meant for display purposes. This may include
74 information additional to what's in browser() (e.g. distinguishing
75 Firefox from Iceweasel).
76
77 If the user agent could not be identified, or if it was identified as a
78 robot instead, returns undef.
79
80 Browser Version
81
82 Please note that that the version(), major() and minor() methods have
83 been deprecated as of release 1.78 of this module. They should be
84 replaced with browser_version(), browser_major(), browser_minor(), and
85 browser_beta().
86
87 The reasoning behind this is that version() method will, in the case of
88 Safari, return the Safari/XXX numbers even when Version/XXX numbers are
89 present in the UserAgent string (i.e. it will return incorrect versions
90 for Safari in some cases).
91
92 browser_version()
93
94 Returns the browser version (major and minor) as a string. For example,
95 for Chrome 36.0.1985.67, this returns "36.0".
96
97 browser_major()
98
99 Returns the major part of the version as a string. For example, for
100 Chrome 36.0.1985.67, this returns "36".
101
102 Returns undef if no version information can be detected.
103
104 browser_minor()
105
106 Returns the minor part of the version as a string. This includes the
107 decimal point; for example, for Chrome 36.0.1985.67, this returns ".0".
108
109 Returns undef if no version information can be detected.
110
111 browser_beta()
112
113 Returns any part of the version after the major and minor version, as a
114 string. For example, for Chrome 36.0.1985.67, this returns ".1985.67".
115 The beta part of the string can contain any type of alphanumeric
116 characters.
117
118 Returns undef if no version information can be detected. Returns an
119 empty string if version information is detected but it contains only a
120 major and minor version with nothing following.
121
122 Operating System
123
124 os()
125
126 Returns one of the following strings, or undef:
127
128 windows, winphone, mac, macosx, linux, android, ios, os2, unix, vms,
129 chromeos, firefoxos, ps3, psp, rimtabletos, blackberry, amiga
130
131 os_string()
132
133 Returns a human formatted version of the OS name. These names are
134 subject to change and are really meant for display purposes. This may
135 include information additional to what's in os() (e.g. distinguishing
136 various editions of Windows from one another) (although for a way to do
137 that that's more suitable for use in program logic, see below under "OS
138 related properties").
139
140 Returns undef if no OS information could be detected.
141
142 os_version()
143
144 Returns Operating System version.
145
146 os_major()
147
148 Returns Operating System major version.
149
150 os_minor()
151
152 Returns Operating System minor version.
153
154 os_beta()
155
156 Returns Operating System beta version.
157
158 Returns version information for the OS, if any could be detected. The
159 format is the same as for the browser_version() functions.
160
161 Mobile Devices
162
163 mobile()
164
165 Returns true if the browser appears to belong to a handheld device.
166
167 tablet()
168
169 Returns true if the browser appears to belong to a tablet device.
170
171 device()
172
173 Returns the type of mobile / tablet hardware, if it can be detected.
174
175 Currently returns one of: android, audrey, avantgo, blackberry, dsi,
176 iopener, ipad, iphone, ipod, kindle, n3ds, palm, ps3, psp, wap, webos,
177 winphone.
178
179 Returns undef if this is not a tablet/mobile device or no hardware
180 information can be detected.
181
182 device_string()
183
184 Returns a human formatted version of the hardware device name. These
185 names are subject to change and are really meant for display purposes.
186 You should use the device() method in your logic. This may include
187 additional information (such as the model of phone if it is
188 detectable).
189
190 Returns undef if this is not a portable device or if no device name can
191 be detected.
192
193 Robots
194
195 robot()
196
197 If the user agent appears to be a robot, spider, crawler, or other
198 automated Web client, this returns one of the following values:
199
200 lwp, slurp, yahoo, msnmobile, msn, msoffice, ahrefs, altavista, apache,
201 askjeeves, baidu, curl, facebook, getright, googleadsbot,
202 googleadsense, googlebotimage, googlebotnews, googlebotvideo,
203 googlemobile, google, golib, indy, infoseek, linkexchange, linkchecker,
204 lycos, mj12bot, puf, rubylib, scooter, specialarchiver, webcrawler,
205 wget, yandexbot, yandeximages, java, unknown
206
207 Returns "unknown" when the user agent is believed to be a robot but is
208 not identified as one of the above specific robots.
209
210 Returns undef if the user agent is not a robot or cannot be identified.
211
212 Note that if a robot crafts a user agent designed to impersonate a
213 particular browser, we generally set properties appropriate to both the
214 actual robot, and the browser it is impersonating. For example,
215 googlebot-mobile pretends to be mobile safari so that it will get
216 mobile versions of pages. In this case, browser() will return 'safari',
217 the properties will generally be set as if for Mobile Safari, the
218 'robot' property will be set, and robot() will return 'googlemobile'.
219
220 lib()
221
222 Returns true if the user agent appears to be an HTTP library or tool
223 (e.g. LWP, curl, wget, java). Generally libraries are also classified
224 as robots, although it is impossible to tell whether they are being
225 operated by an automated system or a human.
226
227 robot_string()
228
229 Returns a human formatted version of the robot name. These names are
230 subject to change and are meant for display purposes. This may include
231 additional information (e.g. robots which return "unknown" from robot()
232 generally can be identified in a human-readable fashion by reading
233 robot_string() ).
234
235 Browser Properties
236
237 Operating systems, devices, browser names, rendering engines, and
238 true-or-false methods (e.g. "mobile" and "lib") are all browser
239 properties. For example, calling browser_properties() for Mobile Safari
240 running on an Android will return this list:
241
242 ('android', 'device', 'mobile', 'mobile_safari', 'safari', 'webkit')
243
244 browser_properties()
245
246 Returns all properties for this user agent, as a list. Note that
247 because a large number of cases must be considered, this will take
248 significantly more time than simply querying the particular methods you
249 care about.
250
251 A mostly complete list of properties follows (i.e. each of these
252 methods is both a method you can call, and also a property that may be
253 in the list returned by browser_properties() ). In addition to this
254 list, robot(), lib(), device(), mobile(), and tablet() are all browser
255 properties.
256
257 OS related properties
258
259 The following methods are available, each returning a true or false
260 value. Some methods also test for the operating system version. The
261 indentations below show the hierarchy of tests (for example, win2k is
262 considered a type of winnt, which is a type of win32)
263
264 windows()
265
266 win16 win3x win31
267 win32
268 winme win95 win98
269 winnt
270 win2k winxp win2k3 winvista win7
271 win8
272 win8_0 win8_1
273 win10
274 win10_0
275 wince
276 winphone
277 winphone7 winphone7_5 winphone8 winphone10
278
279 dotnet()
280
281 chromeos()
282
283 firefoxos()
284
285 mac()
286
287 mac68k macppc macosx ios
288
289 os2()
290
291 bb10()
292
293 rimtabletos()
294
295 unix()
296
297 sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10
298 aix aix1 aix2 aix3 aix4 linux sco unixware mpras reliant
299 dec sinix freebsd bsd
300
301 vms()
302
303 amiga()
304
305 ps3gameos()
306
307 pspgameos()
308
309 It may not be possibile to detect Win98 in Netscape 4.x and earlier. On
310 Opera 3.0, the userAgent string includes "Windows 95/NT4" on all Win32,
311 so you can't distinguish between Win95 and WinNT.
312
313 Browser related properties
314
315 The following methods are available, each returning a true or false
316 value. Some methods also test for the browser version, saving you from
317 checking the version separately.
318
319 aol aol3 aol4 aol5 aol6
320
321 chrome
322
323 emacs
324
325 firefox
326
327 gecko
328
329 icab
330
331 ie ie3 ie4 ie4up ie5 ie5up ie55 ie55up ie6 ie7 ie8 ie9 ie10 ie11
332
333 ie_compat_mode
334
335 The ie_compat_mode is used to determine if the IE user agent is for the
336 compatibility mode view, in which case the real version of IE is higher
337 than that detected. The true version of IE can be inferred from the
338 version of Trident in the engine_version method.
339
340 konqueror
341
342 lotusnotes
343
344 lynx links elinks
345
346 mobile_safari
347
348 mosaic
349
350 mozilla
351
352 neoplanet neoplanet2
353
354 netfront
355
356 netscape nav2 nav3 nav4 nav4up nav45 nav45up navgold nav6 nav6up
357
358 opera opera3 opera4 opera5 opera6 opera7
359
360 realplayer
361
362 The realplayer method above tests for the presence of either the
363 RealPlayer plug-in "(r1 " or the browser "RealPlayer".
364
365 realplayer_browser
366
367 The realplayer_browser method tests for the presence of the RealPlayer
368 browser (but returns 0 for the plugin).
369
370 safari
371
372 staroffice
373
374 webtv
375
376 Netscape 6, even though it's called six, in the User-Agent string has
377 version number 5. The nav6 and nav6up methods correctly handle this
378 quirk. The Firefox test correctly detects the older-named versions of
379 the browser (Phoenix, Firebird).
380
381 Device related properties
382
383 The following methods are available, each returning a true or false
384 value.
385
386 android
387
388 audrey
389
390 avantgo
391
392 blackberry
393
394 dsi
395
396 iopener
397
398 iphone
399
400 ipod
401
402 ipad
403
404 kindle
405
406 n3ds
407
408 obigo
409
410 palm
411
412 webos
413
414 wap
415
416 psp
417
418 ps3
419
420 Robot properties
421
422 The following additional methods are available, each returning a true
423 or false value. This is by no means a complete list of robots that
424 exist on the Web.
425
426 ahrefs
427
428 altavista
429
430 apache
431
432 askjeeves
433
434 baidu
435
436 curl
437
438 facebook
439
440 getright
441
442 golib
443
444 google
445
446 googleadsbot
447
448 googleadsense
449
450 googlemobile
451
452 indy
453
454 infoseek
455
456 java
457
458 linkexchange
459
460 lwp
461
462 lycos
463
464 mj12bot
465
466 msn (same as bing)
467
468 msoffice
469
470 puf
471
472 rubylib
473
474 slurp
475
476 webcrawler
477
478 wget
479
480 yahoo
481
482 yandex
483
484 yandeximages
485
486 Engine properties
487
488 The following properties indicate if a particular rendering engine is
489 being used.
490
491 webkit
492
493 gecko
494
495 trident
496
497 presto
498
499 khtml
500
501 Other methods
502
503 user_agent()
504
505 Returns the value of the user agent string.
506
507 Calling this method with a parameter to set the user agent has now been
508 removed; please use HTTP::BrowserDetect->new() to pass the user agent
509 string.
510
511 country()
512
513 Returns the country string as it may be found in the user agent string.
514 This will be in the form of an upper case 2 character code. ie: US, DE,
515 etc
516
517 language()
518
519 Returns the language string as it is found in the user agent string.
520 This will be in the form of an upper case 2 character code. ie: EN, DE,
521 etc
522
523 engine()
524
525 Returns the rendering engine, one of the following:
526
527 gecko, webkit, khtml, trident, ie, presto, netfront
528
529 Note that this returns "webkit" for webkit based browsers (including
530 Chrome/Blink). This is a change from previous versions of this library,
531 which returned "KHTML" for webkit.
532
533 Returns undef if none of the above rendering engines can be detected.
534
535 engine_string()
536
537 Returns a human formatted version of the rendering engine.
538
539 Note that this returns "WebKit" for webkit based browsers (including
540 Chrome/Blink). This is a change from previous versions of this library,
541 which returned "KHTML" for webkit.
542
543 Returns undef if none of the known rendering engines can be detected.
544
545 engine_version()
546
547 Returns engine's version.
548
549 engine_major()
550
551 Returns engine's major version.
552
553 engine_minor()
554
555 Returns engine's minor version.
556
557 engine_beta()
558
559 Return's engine's beta version.
560
561 Deprecated methods
562
563 device_name()
564
565 Deprecated alternate name for device_string()
566
567 version()
568
569 This is probably not what you want. Please use either browser_version()
570 or engine_version() instead.
571
572 Returns the version (major and minor) as a string.
573
574 This function returns wrong values for some Safari versions, for
575 compatibility with earlier code. browser_version() returns correct
576 version numbers for Safari.
577
578 major()
579
580 This is probably not what you want. Please use either browser_major()
581 or engine_major() instead.
582
583 Returns the integer portion of the browser version as a string.
584
585 This function returns wrong values for some Safari versions, for
586 compatibility with earlier code. browser_version() returns correct
587 version numbers for Safari.
588
589 minor()
590
591 This is probably not what you want. Please use either browser_minor()
592 or engine_minor() instead.
593
594 Returns the decimal portion of the browser version as a string.
595
596 This function returns wrong values for some Safari versions, for
597 compatibility with earlier code. browser_version() returns correct
598 version numbers for Safari.
599
600 beta()
601
602 This is probably not what you want. Please use browser_beta() instead.
603
604 Returns the beta version, consisting of any characters after the major
605 and minor version number, as a string.
606
607 This function returns wrong values for some Safari versions, for
608 compatibility with earlier code. browser_version() returns correct
609 version numbers for Safari.
610
611 public_version()
612
613 Deprecated. Please use browser_version() instead.
614
615 public_major()
616
617 Deprecated. Please use browser_major() instead.
618
619 public_minor()
620
621 Deprecated. Please use browser_minor() instead.
622
623 public_beta()
624
625 Deprecated. Please use browser_beta() instead.
626
627 gecko_version()
628
629 If a Gecko rendering engine is used (as in Mozilla or Firefox), returns
630 the engine version. If no Gecko browser is being used, or the version
631 number can't be detected, returns undef.
632
633 This is an old function, preserved for compatibility; please use
634 engine_version() in new code.
635
636 CREDITS
637
638 Lee Semel, lee@semel.net (Original Author)
639
640 Peter Walsham (co-maintainer)
641
642 Olaf Alders, olaf at wundercounter.com (co-maintainer)
643
644 ACKNOWLEDGEMENTS
645
646 Thanks to the following for their contributions:
647
648 cho45
649
650 Leonardo Herrera
651
652 Denis F. Latypoff
653
654 merlynkline
655
656 Simon Waters
657
658 Toni Cebrin
659
660 Florian Merges
661
662 david.hilton.p
663
664 Steve Purkis
665
666 Andrew McGregor
667
668 Robin Smidsrod
669
670 Richard Noble
671
672 Josh Ritter
673
674 Mike Clarke
675
676 Marc Sebastian Pelzer
677
678 Alexey Surikov
679
680 Maros Kollar
681
682 Jay Rifkin
683
684 Luke Saunders
685
686 Jacob Rask
687
688 Heiko Weber
689
690 Jon Jensen
691
692 Jesse Thompson
693
694 Graham Barr
695
696 Enrico Sorcinelli
697
698 Olivier Bilodeau
699
700 Yoshiki Kurihara
701
702 Paul Findlay
703
704 Uwe Voelker
705
706 Douglas Christopher Wilson
707
708 John Oatis
709
710 Atsushi Kato
711
712 Ronald J. Kimball
713
714 Bill Rhodes
715
716 Thom Blake
717
718 Aran Deltac
719
720 yeahoffline
721
722 David Ihnen
723
724 Hao Wu
725
726 Perlover
727
728 Daniel Stadie
729
730 ben hengst
731
732 Andrew Moise
733
734 Atsushi Kato
735
736 Marco Fontani
737
738 TO DO
739
740 POD coverage is not 100%.
741
742 SEE ALSO
743
744 "Browser ID (User-Agent) Strings",
745 http://www.zytrax.com/tech/web/browser_ids.htm
746
747 HTML::ParseBrowser.
748
749
750 SUPPORT
751
752 You can find documentation for this module with the perldoc command.
753
754 perldoc HTTP::BrowserDetect
755
756 You can also look for information at:
757
758 * GitHub Source Repository
759
760 http://github.com/oalders/http-browserdetect
761
762 * Reporting Issues
763
764 https://github.com/oalders/http-browserdetect/issues
765
766 * AnnoCPAN: Annotated CPAN documentation
767
768 http://annocpan.org/dist/HTTP-BrowserDetect
769
770 * CPAN Ratings
771
772 http://cpanratings.perl.org/d/HTTP-BrowserDetect
773
774 * Search CPAN
775
776 https://metacpan.org/module/HTTP::BrowserDetect
777
778 BUGS AND LIMITATIONS
779
780 The biggest limitation at this point is the test suite, which really
781 needs to have many more UserAgent strings to test against.
782
783 CONTRIBUTING
784
785 Patches are certainly welcome, with many thanks for the excellent
786 contributions which have already been received. The preferred method of
787 patching would be to fork the GitHub repo and then send me a pull
788 request, but plain old patch files are also welcome.
789
790 If you're able to add test cases, this will speed up the time to
791 release your changes. Just edit t/useragents.json so that the test
792 coverage includes any changes you have made. Please contact me if you
793 have any questions.
794
795 This distribution uses Dist::Zilla. If you're not familiar with this
796 module, please see
797 https://github.com/oalders/http-browserdetect/issues/5 for some helpful
798 tips to get you started.
799
0 requires "JSON::PP" => "2.27300";
01 requires "perl" => "5.006";
12 requires "strict" => "0";
23 requires "vars" => "0";
89
910 on 'test' => sub {
1011 requires "FindBin" => "0";
11 requires "JSON::PP" => "0";
12 requires "JSON::PP" => "2.27300";
1213 requires "Path::Tiny" => "0";
1314 requires "Test::FailWarnings" => "0";
1415 requires "Test::More" => "0";
33 author = Olaf Alders <olaf@wundercounter.com> (current maintainer)
44 license = Perl_5
55 copyright_holder = Lee Semel
6 copyright_year = 2015
7 version = 2.07
6 copyright_year = 2016
7 version = 2.08
88 main_module = lib/HTTP/BrowserDetect.pm
99
1010 [GatherDir]
33 use 5.006;
44
55 package HTTP::BrowserDetect;
6 $HTTP::BrowserDetect::VERSION = '2.07';
6 $HTTP::BrowserDetect::VERSION = '2.08';
77 use vars qw(@ALL_TESTS);
88
99 # Operating Systems
7575 webtv browsex silk
7676 applecoremedia galeon seamonkey
7777 epiphany ucbrowser dalvik
78 edge
78 edge brave
7979 );
8080
8181 our @IE_TESTS = qw(
197197 aol => 'AOL Browser',
198198 applecoremedia => 'AppleCoreMedia',
199199 blackberry => 'BlackBerry',
200 brave => 'Brave',
200201 browsex => 'BrowseX',
201202 chrome => 'Chrome',
202203 curl => 'curl',
579580 # $browser_string = 'Maxthon';
580581 #}
581582 }
583 elsif ( index( $ua, "brave" ) != -1 ) {
584
585 # Has to go above Chrome, it includes "like Chrome/"
586
587 $browser = 'brave';
588 $browser_tests->{$browser} = 1;
589 }
582590 elsif ( index( $ua, "silk" ) != -1 ) {
583591
584592 # Has to go above Chrome, it includes "like Chrome/"
15081516 $major = $1;
15091517 $minor = $2;
15101518 $beta = $3;
1519 }
1520 elsif ( $browser eq 'brave' ) {
1521
1522 # Note: since 0.7.10, Brave has changed the branding
1523 # of GitHub's "Electron" (http://electron.atom.io/) to "Brave".
1524 # This means the browser string has both "brave/" (the browser)
1525 # and "Brave/" (re-branded Electron) in it.
1526 # The generic section below looks at $self->{browser_string}, which is "Brave"
1527 # (Electron) and not $self->{browser} which is "brave".
1528 # Caveat parser.
1529 if ( $ua =~ m{brave/(\d+)\.(\d+)([\d.]*)} ) {
1530 $major = $1;
1531 $minor = $2;
1532 $beta = $3;
1533 }
15111534 }
15121535 elsif ($browser eq 'chrome'
15131536 && $ua =~ m{crios/(\d+)\.(\d+)([\d.]*)} ) {
24432466
24442467 =head1 VERSION
24452468
2446 version 2.07
2469 version 2.08
24472470
24482471 =head1 SYNOPSIS
24492472
25102533 browsex, dalvik, elinks, links, lynx, emacs, epiphany, galeon,
25112534 konqueror, icab, lotusnotes, mosaic, mozilla, netfront, netscape,
25122535 n3ds, dsi, obigo, realplayer, seamonkey, silk, staroffice, ucbrowser,
2513 webtv
2536 webtv, brave
25142537
25152538 If the browser could not be identified (either because unrecognized
25162539 or because it is a robot), returns C<undef>.
32653288
32663289 =head1 COPYRIGHT AND LICENSE
32673290
3268 This software is copyright (c) 2015 by Lee Semel.
3291 This software is copyright (c) 2016 by Lee Semel.
32693292
32703293 This is free software; you can redistribute it and/or modify it under
32713294 the same terms as the Perl 5 programming language system itself.
1013410134 "os_string" : "Mac OS X",
1013510135 "robot" : 0
1013610136 },
10137 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) brave/0.7.9 Chrome/47.0.2526.73 Electron/0.36.2 Safari/537.36" : {
10138 "browser" : "brave",
10139 "browser_beta" : ".9",
10140 "browser_major" : "0",
10141 "browser_minor" : ".7",
10142 "browser_string" : "Brave",
10143 "engine" : "webkit",
10144 "engine_beta" : "",
10145 "engine_major" : "537",
10146 "engine_minor" : ".36",
10147 "engine_string" : "WebKit",
10148 "match" : [
10149 "mac",
10150 "macosx",
10151 "brave",
10152 "webkit"
10153 ],
10154 "os" : "macosx",
10155 "os_beta" : ".3",
10156 "os_major" : "10",
10157 "os_minor" : ".11",
10158 "os_string" : "Mac OS X",
10159 "robot" : 0
10160 },
1013710161 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_2) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1" : {
1013810162 "browser" : "chrome",
1013910163 "browser_beta" : ".782.41",
1271212736 "os_string" : "Win7",
1271312737 "robot" : 0
1271412738 },
12739 "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) brave/0.7.10 Chrome/47.0.2526.110 Brave/0.36.5 Safari/537.36" : {
12740 "browser" : "brave",
12741 "browser_beta" : ".10",
12742 "browser_major" : "0",
12743 "browser_minor" : ".7",
12744 "browser_string" : "Brave",
12745 "engine" : "webkit",
12746 "engine_beta" : "",
12747 "engine_major" : "537",
12748 "engine_minor" : ".36",
12749 "engine_string" : "WebKit",
12750 "match" : [
12751 "windows",
12752 "winnt",
12753 "win32",
12754 "win7",
12755 "brave",
12756 "webkit"
12757 ],
12758 "os" : "windows",
12759 "os_string" : "Win7",
12760 "robot" : 0
12761 },
1271512762 "Mozilla/5.0 (Windows NT 6.1; Win64; x64) KomodiaBot/1.0" : {
1271612763 "browser" : "netscape",
1271712764 "browser_major" : "5",