| 1 | # ABSTRACT: A role for image objects that is used to generate HTML with parameters such as geometry. | ||||||||||
| 2 | package Devel::IPerl::Display::Role::WebImage; | ||||||||||
| 3 | 2 | $Devel::IPerl::Display::Role::WebImage::VERSION = '0.012'; | |||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 2 | with qw(Devel::IPerl::Display::Role::Displayable); | |||||||||
| 10 | |||||||||||
| 11 | 2 | requires '_as_text_plain'; | |||||||||
| 12 | 2 | requires 'mimetype'; | |||||||||
| 13 | |||||||||||
| 14 | 2 | has [ qw[width height] ] => ( is => 'rw', predicate => 1 ); | |||||||||
| 15 | |||||||||||
| 16 | 5 | ▶ | sub iperl_data_representations { | ||||||||
|
Subroutine
iperl_data_representations: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||
| 17 | 5 | my ($self) = @_; | |||||||||
| 18 | 5 | my $data = $self->_data; # TODO when data is not retrievable | |||||||||
| 19 | return { | ||||||||||
| 20 | 5 | $self->mimetype => $data, | |||||||||
| 21 | "text/plain" => $self->_as_text_plain, | ||||||||||
| 22 | "text/html" => qq|<img | ||||||||||
| 23 | 0 | ▶ | @{[ $self->has_width ? qq,width="@{[$self->width]}", : "" ]} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | ▶ | @{[ $self->has_height ? qq,height="@{[$self->height]}", : "" ]} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 5 | src="@{[ $self->_html_uri ]}" />|, | |||||||||
| 26 | }; | ||||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 2 | 1; | |||||||||
| 30 | |||||||||||
| 31 | __END__ | ||||||||||