| 1 | package WWW::Mechanize::Image; | ||||||||||||
| 2 | |||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 5 | our $VERSION = '2.21'; | |||||||||||
| 7 | |||||||||||||
| 8 | #ABSTRACT: Image object for WWW::Mechanize | ||||||||||||
| 9 | |||||||||||||
| 10 | |||||||||||||
| 11 | sub new { | ||||||||||||
| 12 | 42 | ▶ | my $class = shift; | ||||||||||
|
Subroutine
new: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||
| 13 | 42 | ▶ | my $params = shift || {}; | ||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 14 | |||||||||||||
| 15 | 42 | my $self = bless {}, $class; | |||||||||||
| 16 | |||||||||||||
| 17 | 42 | for my $param (qw( url base tag height width alt name attrs )) { | |||||||||||
| 18 | |||||||||||||
| 19 | # Check for what we passed in, not whether it's defined | ||||||||||||
| 20 | 336 | ▶ | $self->{$param} = $params->{$param} if exists $params->{$param}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | } | ||||||||||||
| 22 | |||||||||||||
| 23 | # url and tag are always required | ||||||||||||
| 24 | 42 | for (qw( url tag )) { | |||||||||||
| 25 | 84 | ▶ | exists $self->{$_} | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 26 | or die "WWW::Mechanize::Image->new must have a $_ argument"; | ||||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | 42 | return $self; | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | |||||||||||||
| 33 | 409 | ▶ | sub url { return ( $_[0] )->{url}; } | ||||||||||
|
Subroutine
url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 34 | 126 | ▶ | sub base { return ( $_[0] )->{base}; } | ||||||||||
|
Subroutine
base: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 35 | 1 | ▶ | sub name { return ( $_[0] )->{name}; } | ||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 36 | 189 | ▶ | sub tag { return ( $_[0] )->{tag}; } | ||||||||||
|
Subroutine
tag: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 37 | 7 | ▶ | sub height { return ( $_[0] )->{height}; } | ||||||||||
|
Subroutine
height: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 38 | 2 | ▶ | sub width { return ( $_[0] )->{width}; } | ||||||||||
|
Subroutine
width: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 39 | 76 | ▶ | sub alt { return ( $_[0] )->{alt}; } | ||||||||||
|
Subroutine
alt: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 40 | 299 | ▶ | sub attrs { return ( $_[0] )->{attrs}; } | ||||||||||
|
Subroutine
attrs: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 41 | |||||||||||||
| 42 | |||||||||||||
| 43 | sub URI { | ||||||||||||
| 44 | 125 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
URI: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 45 | |||||||||||||
| 46 | 125 | require URI::URL; | |||||||||||
| 47 | 125 | my $URI = URI::URL->new( $self->url, $self->base ); | |||||||||||
| 48 | |||||||||||||
| 49 | 125 | return $URI; | |||||||||||
| 50 | } | ||||||||||||
| 51 | |||||||||||||
| 52 | |||||||||||||
| 53 | sub url_abs { | ||||||||||||
| 54 | 123 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
url_abs: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 55 | |||||||||||||
| 56 | 123 | return $self->URI->abs; | |||||||||||
| 57 | } | ||||||||||||
| 58 | |||||||||||||
| 59 | |||||||||||||
| 60 | 5 | 1; | |||||||||||
| 61 | |||||||||||||
| 62 | __END__ | ||||||||||||