1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/usr/bin/perl use strict; use warnings; use diagnostics; use HTTP::DetectUserAgent 0.04; use 5.010; my %ua = ( Opera_1216 => 'Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.16', Firefox_24 => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0', IE_10 => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Win64; x64; Trident/6.0)', Opera_18 => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.8 Safari/537.36 OPR/18.0.1284.5 (Edition Developer)', IE_11 => 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko', Firefox_25 => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0', ); for my $k (sort {lc $a cmp lc $b} keys %ua) { my $ua = HTTP::DetectUserAgent->new($ua{$k}) or die; say "$k: ",$ua->type, " ",$ua->name; }
1
2
3
4
5
6
Firefox_24: Browser Firefox
Firefox_25: Browser Firefox
IE_10: Browser Internet Explorer
IE_11: Unknown Unknown
Opera_1216: Browser Opera
Opera_18: Browser Chrome
2013-11-22T09:55:10 pq...(wann kam der IE 11 raus ...
http://cpansearch.perl.org/src/NEILB/HTTP-DetectUserAgent-0.04/lib/HTTP/Code: (dl )1
2
3
4
5Index of /src/NEILB/HTTP-DetectUserAgent-0.04/lib/HTTP
Icon Name Last modified Size
[DIR] Parent Directory -
[TXT] DetectUserAgent.pm 27-Sep-2012 06:35 16K
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
sub _check_ie { my ( $self, $ua, $block ) = @_; $self->{engine} = 'Internet Explorer'; $self->{type} = 'Browser'; if( $block->{sleipnir} ){ $self->{name} = 'Sleipnir'; $self->{version} = $block->{sleipnir}; $self->{vendor} = 'Fenrir'; }elsif( $block->{_comment} =~ /lunascape\s+([\d.]+)/){ $self->{name} = 'Lunascape'; $self->{version} = $1; $self->{vendor} = 'Lunascape'; }elsif( $block->{_comment} =~ m{kiki/([\d.]+)}){ $self->{name} = 'KIKI'; $self->{version} = $1; $self->{vendor} = 'http://www.din.or.jp/~blmzf/index.html'; }elsif( $block->{_comment} =~ /msie\s+([\d.]+)/){ $self->{name} = 'Internet Explorer'; $self->{version} = $1; $self->{vendor} = 'Microsoft'; } # new IE 11 has new UA: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko elsif( $block->{_comment} =~ /Trident\/[\d.]+;\s+rv:([\d.]+)/){ $self->{name} = 'Internet Explorer'; $self->{version} = $1; $self->{vendor} = 'Microsoft'; } }
1 2 3 4 5
sub _parse_name { ... }elsif( $block->{'_comment'} && index($block->{'_comment'}, 'msie' ) != -1 ){ $self->_check_ie($ua, $block);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
use 5.010; use strict; use warnings; my $block; my $ua; while ($ua=<DATA>) { chomp $ua; $block->{_comment} = $ua; if ($block->{_comment} =~ /Trident\/[\d.]+;\s+(?:.+)?rv:([\d.]+)/) { say "$ua --> IE $1"; } } # UAs siehe http://blogs.msdn.com/b/ieinternals/archive/2013/09/21/internet-explorer-11-user-agent-string-ua-string-sniffing-compatibility-with-gecko-webkit.aspx # https://iecvlist.microsoft.com/IE11/1375395130872/iecompatviewlist.xml __DATA__ Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko Mozilla/5.0 (Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5 Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 Mozilla/5.0 (Windows NT 6.2; rv:12.0) Gecko/20100101 Firefox/12.0 Mozilla/5.0 ($PLATFORM; Trident/7.0; rv:11.0) like Gecko/20100101 Firefox/12.0 Mozilla/5.0 ($PLATFORM; Trident/7.0; rv:11.0) like Gecko/20100101 Firefox/22.0 Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0) Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) Mozilla/5.0 (compatible; MSIE 10.0; $PLATFORM; Trident/7.0) Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0) Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0) Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0) Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch) Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0) Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Xbox; Xbox One) Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; Xbox) Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 Mozilla/5.0 (Windows NT 6.2; rv:12.0) Gecko/20100101 Firefox/23.0 Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 OPR/15.0.1147.153 Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25 Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
1 2 3 4 5 6 7
}elsif( $block->{'_comment'} && ( index($block->{'_comment'}, 'msie' ) != -1 or index($block->{'_comment'}, 'Trident' ) != -1 ) ){
2013-11-23T07:46:11 GwenDragonFunktioniert das denn so wie ich das gepostet habe?
2013-11-23T14:36:23 GwenDragonDann patcht du eben nicht.
2013-11-23T14:36:23 GwenDragonDas Modul kann nur der Modulautor bei CPAN ändern, wann er das nach Empfang eines Patches macht weiß ich nicht.
2013-11-23T14:36:23 GwenDragon
2013-11-23T15:20:34 bianca
2013-11-23T14:36:23 GwenDragonDas Modul kann nur der Modulautor bei CPAN ändern, wann er das nach Empfang eines Patches macht weiß ich nicht.
Kennt den vielleicht jemand und kann nachfragen?
2013-11-23T15:20:34 biancaDas Modul zieht bei mir seit einigen Minuten einen riesengroßen Rattenschwanz von anderen Modulen hinter sich her.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/usr/bin/perl use strict; use warnings; use diagnostics; use HTTP::BrowserDetect 1.63; use 5.010; my %ua = ( Opera_1216 => 'Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.16', Firefox_24 => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0', IE_10 => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Win64; x64; Trident/6.0)', Opera_18 => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.8 Safari/537.36 OPR/18.0.1284.5 (Edition Developer)', IE_11 => 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko', Firefox_25 => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0', muell => 'Negativtest', ); for my $k (sort {lc $a cmp lc $b} keys %ua) { my $browser = HTTP::BrowserDetect->new($ua{$k}) or die; say "$k: ",(defined $browser->browser_string() && defined $browser->version() ? $browser->browser_string().' '.$browser->version() : 'unbekannt'); }
1
2
3
4
5
6
7
Firefox_24: Firefox 24
Firefox_25: Firefox 25
IE_10: MSIE 10
IE_11: MSIE 11
muell: unbekannt
Opera_1216: Opera 12.16
Opera_18: Chrome 31