line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
|
|
|
|
$Devel::IPerl::Display::Role::WebImage::VERSION = '0.008'; |
4
|
2
|
|
|
2
|
|
1049
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
64
|
|
5
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
13
|
use Moo::Role; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
12
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with qw(Devel::IPerl::Display::Role::Displayable); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
requires '_as_text_plain'; |
12
|
|
|
|
|
|
|
requires 'mimetype'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has [ qw[width height] ] => ( is => 'rw', predicate => 1 ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub iperl_data_representations { |
17
|
5
|
|
|
5
|
0
|
193
|
my ($self) = @_; |
18
|
5
|
|
|
|
|
67
|
my $data = $self->_data; # TODO when data is not retrievable |
19
|
|
|
|
|
|
|
return { |
20
|
5
|
|
|
|
|
25
|
$self->mimetype => $data, |
21
|
|
|
|
|
|
|
"text/plain" => $self->_as_text_plain, |
22
|
|
|
|
|
|
|
"text/html" => qq|<img |
23
|
5
|
50
|
|
|
|
26
|
@{[ $self->has_width ? qq,width="@{[$self->width]}", : "" ]} |
|
0
|
|
|
|
|
0
|
|
24
|
5
|
50
|
|
|
|
14
|
@{[ $self->has_height ? qq,height="@{[$self->height]}", : "" ]} |
|
0
|
|
|
|
|
0
|
|
25
|
5
|
|
|
|
|
12
|
src="@{[ $self->_html_uri ]}" />|, |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=pod |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=encoding UTF-8 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Devel::IPerl::Display::Role::WebImage - A role for image objects that is used to generate HTML with parameters such as geometry. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 VERSION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
version 0.008 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $web_image = Displayable::With::WebImage->new( |
48
|
|
|
|
|
|
|
data => "...", |
49
|
|
|
|
|
|
|
width => '100px', |
50
|
|
|
|
|
|
|
height => '200px' ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This role returns an HTML representation that takes into account the height and |
55
|
|
|
|
|
|
|
width. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 AUTHOR |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Zakariyya Mughal <zmughal@cpan.org> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Zakariyya Mughal. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
66
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |