lib/PDF/FromHTML/Template/Element/Weblink.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 38 CC 4 SCAR 24.0
CC
4
Cov
0%
render
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 11.0
1 package PDF::FromHTML::Template::Element::Weblink;
2  
3 use strict;
4  
5 BEGIN {
6 use vars qw(@ISA);
7 @ISA = qw(PDF::FromHTML::Template::Element);
8  
9 use PDF::FromHTML::Template::Element;
10 }
11  
12 sub render
13 {
14 my $self = shift;
15 my ($context) = @_;
16  
17 return 0 unless $self->should_render($context);
18  
19 return 1 if $context->{CALC_LAST_PAGE};
20  
21 my $url = $context->get($self, 'URL');
22  
23 unless (defined $url)
24 {
25 warn "Weblink: no URL defined!", $/;
26 return 1;
27 }
28  
29 my @dimensions = map {
30 $context->get($self, $_) || 0
31 } qw( X1 Y1 X2 Y2 );
32  
33 $context->{PDF}->add_weblink( @dimensions, $url );
34  
35 return 1;
36 }
37  
38 1;
39 __END__