| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WWW::Mechanize::Image; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 4 |  |  | 4 |  | 67661 | use strict; | 
|  | 4 |  |  |  |  | 20 |  | 
|  | 4 |  |  |  |  | 205 |  | 
| 4 | 4 |  |  | 4 |  | 97 | use warnings; | 
|  | 4 |  |  |  |  | 17 |  | 
|  | 4 |  |  |  |  | 2031 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | our $VERSION = '2.16'; | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | #ABSTRACT: Image object for WWW::Mechanize | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | sub new { | 
| 12 | 40 |  |  | 40 | 1 | 255 | my $class = shift; | 
| 13 | 40 |  | 50 |  |  | 106 | my $params = shift || {}; | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 40 |  |  |  |  | 76 | my $self = bless {}, $class; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 40 |  |  |  |  | 98 | for my $param ( qw( url base tag height width alt name attrs ) ) { | 
| 18 |  |  |  |  |  |  | # Check for what we passed in, not whether it's defined | 
| 19 | 320 | 100 |  |  |  | 853 | $self->{$param} = $params->{$param} if exists $params->{$param}; | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | # url and tag are always required | 
| 23 | 40 |  |  |  |  | 75 | for ( qw( url tag ) ) { | 
| 24 | 80 | 50 |  |  |  | 176 | exists $self->{$_} or die "WWW::Mechanize::Image->new must have a $_ argument"; | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 40 |  |  |  |  | 182 | return $self; | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 407 |  |  | 407 | 1 | 76034 | sub url     { return ($_[0])->{url}; } | 
| 32 | 126 |  |  | 126 | 1 | 368 | sub base    { return ($_[0])->{base}; } | 
| 33 | 1 |  |  | 1 | 1 | 6 | sub name    { return ($_[0])->{name}; } | 
| 34 | 189 |  |  | 189 | 1 | 1614 | sub tag     { return ($_[0])->{tag}; } | 
| 35 | 7 |  |  | 7 | 1 | 169 | sub height  { return ($_[0])->{height}; } | 
| 36 | 2 |  |  | 2 | 1 | 12 | sub width   { return ($_[0])->{width}; } | 
| 37 | 76 |  |  | 76 | 1 | 674 | sub alt     { return ($_[0])->{alt}; } | 
| 38 | 299 |  |  | 299 | 1 | 3179 | sub attrs   { return ($_[0])->{attrs}; } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | sub URI { | 
| 42 | 125 |  |  | 125 | 1 | 1641 | my $self = shift; | 
| 43 |  |  |  |  |  |  |  | 
| 44 | 125 |  |  |  |  | 1474 | require URI::URL; | 
| 45 | 125 |  |  |  |  | 12322 | my $URI = URI::URL->new( $self->url, $self->base ); | 
| 46 |  |  |  |  |  |  |  | 
| 47 | 125 |  |  |  |  | 26264 | return $URI; | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | sub url_abs { | 
| 52 | 123 |  |  | 123 | 1 | 17901 | my $self = shift; | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 123 |  |  |  |  | 235 | return $self->URI->abs; | 
| 55 |  |  |  |  |  |  | } | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | 1; | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | __END__ |