| 1 | package HTTP::MobileAgent::Flash; | ||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 4 | 3 | ▶ | use vars qw($VERSION); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 5 | 3 | $VERSION = '0.20'; | |||||||||||||||||
| 6 | 3 | ▶ | use 5.008001; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 7 | |||||||||||||||||||
| 8 | 3 | ▶ | use HTTP::MobileAgent; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 9 | 3 | ▶ | use HTTP::MobileAgent::Flash::DoCoMoFlashMap; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 10 | 3 | ▶ | use HTTP::MobileAgent::Flash::EZWebFlashMap; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 11 | 3 | ▶ | use HTTP::MobileAgent::Flash::SoftBankFlashMap; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 12 | |||||||||||||||||||
| 13 | 3 | ▶ | use Carp; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 14 | |||||||||||||||||||
| 15 | 3 | ▶ | use base qw(Class::Accessor); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 16 | 3 | __PACKAGE__->mk_ro_accessors(qw(max_file_size version width height)); | |||||||||||||||||
| 17 | |||||||||||||||||||
| 18 | 3 | ▶ | sub import { | ||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 19 | 3 | my $class = shift; | |||||||||||||||||
| 20 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 21 | 3 | *{"HTTP\::MobileAgent\::flash"} = \&_flash; | |||||||||||||||||
| 22 | 3 | *{"HTTP\::MobileAgent\::is_flash"} = \&_is_flash; | |||||||||||||||||
| 23 | } | ||||||||||||||||||
| 24 | |||||||||||||||||||
| 25 | 49 | ▶ | sub _flash { | ||||||||||||||||
|
Subroutine
_flash: called CC=2 SCAR=6.9
| |||||||||||||||||||
| 26 | 49 | my $self = shift; | |||||||||||||||||
| 27 | 49 | ▶ | unless ($self->{flash}) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 28 | 15 | $self->{flash} = HTTP::MobileAgent::Flash->new($self); | |||||||||||||||||
| 29 | } | ||||||||||||||||||
| 30 | 49 | return $self->{flash}; | |||||||||||||||||
| 31 | } | ||||||||||||||||||
| 32 | |||||||||||||||||||
| 33 | 15 | ▶ | sub _is_flash { | ||||||||||||||||
|
Subroutine
_is_flash: called CC=2 SCAR=6.9
| |||||||||||||||||||
| 34 | 15 | my $self = shift; | |||||||||||||||||
| 35 | 15 | ▶ | return ($self->flash->version > 0)? 1 : 0; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 36 | } | ||||||||||||||||||
| 37 | |||||||||||||||||||
| 38 | 15 | ▶ | sub new { | ||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||
| 39 | 15 | my ($class, $agent) = @_; | |||||||||||||||||
| 40 | |||||||||||||||||||
| 41 | 15 | my $map; | |||||||||||||||||
| 42 | 15 | ▶ | if ($agent->is_docomo) { | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 43 | 5 | $map = $HTTP::MobileAgent::Flash::DoCoMoFlashMap::FLASH_MAP->{uc($agent->model)}; | |||||||||||||||||
| 44 | } | ||||||||||||||||||
| 45 | elsif ($agent->is_ezweb) { | ||||||||||||||||||
| 46 | 7 | $map = $HTTP::MobileAgent::Flash::EZWebFlashMap::FLASH_MAP->{uc($agent->model)}; | |||||||||||||||||
| 47 | } | ||||||||||||||||||
| 48 | elsif ($agent->is_softbank) { | ||||||||||||||||||
| 49 | 1 | $map = $HTTP::MobileAgent::Flash::SoftBankFlashMap::FLASH_MAP->{uc($agent->model)}; | |||||||||||||||||
| 50 | } | ||||||||||||||||||
| 51 | |||||||||||||||||||
| 52 | 15 | ▶ | if ($map) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 53 | 9 | return bless $map, $class; | |||||||||||||||||
| 54 | } | ||||||||||||||||||
| 55 | else { | ||||||||||||||||||
| 56 | 6 | return bless { | |||||||||||||||||
| 57 | max_file_size => -1, | ||||||||||||||||||
| 58 | version => -1, | ||||||||||||||||||
| 59 | width => -1, | ||||||||||||||||||
| 60 | height => -1, | ||||||||||||||||||
| 61 | }, $class; | ||||||||||||||||||
| 62 | } | ||||||||||||||||||
| 63 | } | ||||||||||||||||||
| 64 | |||||||||||||||||||
| 65 | 7 | ▶ | sub is_supported { | ||||||||||||||||
|
Subroutine
is_supported: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||
| 66 | 7 | my $self = shift; | |||||||||||||||||
| 67 | 7 | ▶ | my $version = shift || ""; | ||||||||||||||||
|
Condition50%1/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||
| 68 | |||||||||||||||||||
| 69 | 7 | ▶ | croak "You must set version before call is_supported()" if ($version eq ""); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 70 | |||||||||||||||||||
| 71 | 7 | $version =~ s/Lite//ig; | |||||||||||||||||
| 72 | 7 | ▶ | return ($version <= $self->version)? 1 : 0; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 73 | } | ||||||||||||||||||
| 74 | |||||||||||||||||||
| 75 | 3 | 1; | |||||||||||||||||
| 76 | __END__ | ||||||||||||||||||