| 1 | package HTTP::UserAgentString::OS; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | HTTP::UserAgentString::OS - Operating system | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | $os = $browser->os() | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | print "Name: ", $os->name(), "\n"; | ||||||||||||||||||||||||||||
| 12 | print "Family: ", $os->family(), "\n"; | ||||||||||||||||||||||||||||
| 13 | print "URL: ", $os->url(), "\n"; | ||||||||||||||||||||||||||||
| 14 | print "Company: ", $os->company(), "\n"; | ||||||||||||||||||||||||||||
| 15 | print "Company URL: ", $os->company_url(), "\n"; | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | Used to represent operating systems returned where browsers or | ||||||||||||||||||||||||||||
| 20 | robots run. The class is read only. Accesors are provided for | ||||||||||||||||||||||||||||
| 21 | all capabilities defined by user-agent-string.info | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | =head1 METHODS | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =over 4 | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =item $os->name() | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | OS name (includes version). Example: Windows 95 | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | =item $os->family() | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | OS family. I.e: Windows | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | =item $os->url() | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | Web page for the OS | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =item $os->company() | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | Name of the company that develops the OS | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =item $os->company_url() | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | URL of the company that develops the OS | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =item $os->ico() | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | Icon for the OS, found in http://user-agent-string.info/pub/img/os/ | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =back | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | Copyright (c) 2011 Nicolas Moldavsky (http://www.e-planning.net/) | ||||||||||||||||||||||||||||
| 56 | This library is released under LGPL V3 | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =cut | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 61 | 4 | ▶ | use base qw(HTTP::UserAgentString::Sys); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 4 | my @KEYS = qw(family name url company company_url ico); | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub new($$) { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 66 | 0 | my ($pkg, $data) = @_; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | my $h = {}; | |||||||||||||||||||||||||||
| 69 | 0 | ▶ | for (my $i = 0; $i < scalar(@KEYS); $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | my $val = $data->[$i]; | |||||||||||||||||||||||||||
| 71 | 0 | ▶ | if (defined($val) and (length($val) > 0)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $val and length $val > 0
MC/DC0%0/2
defined $val and length $val > 0
defined $val
length $val > 0
Truth table0%0/3
A and B
A= defined $valB= length $val > 0
| |||||||||||||||||||||||||||||
| 72 | 0 | $h->{$KEYS[$i]} = $val; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | 0 | return bless($h, $pkg); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub family($) { $_[0]->{family} } | ||||||||||||||||||||||||||
|
Subroutine
family: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub ico($) { $_[0]->{ico} } | ||||||||||||||||||||||||||
|
Subroutine
ico: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub name($) { $_[0]->{name} } | ||||||||||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub company($) { $_[0]->{company} } | ||||||||||||||||||||||||||
|
Subroutine
company: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub company_url($) { $_[0]->{company_url} } | ||||||||||||||||||||||||||
|
Subroutine
company_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | sub url($) { $_[0]->{url} } | ||||||||||||||||||||||||||
|
Subroutine
url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 4 | 1; | |||||||||||||||||||||||||||