lib/PDF/FromHTML/Template/Container/Margin.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 49 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
enter_scope
2.0
exit_scope
2.0
CRAP 2.0
1 package PDF::FromHTML::Template::Container::Margin;
2  
3 use strict;
4  
5 BEGIN {
6 use vars qw(@ISA);
7 @ISA = qw(PDF::FromHTML::Template::Container::Always);
8  
9 use PDF::FromHTML::Template::Container::Always;
10 }
11  
12 # This is the common parent for <header> and <footer>. It exists so that
13 # common code can be factored out. The code here is used for redefining
14 # Context::should_render(). Normally, it restricts display only to
15 # between the top and bottom margins. However, footers and headers are
16 # supposed to write in those margins, so the children of this type of
17 # node need to be allowed anywhere on the page.
18  
19 sub enter_scope
20 {
21 my $self = shift;
22 my ($context) = @_;
23  
24 $self->SUPER::enter_scope($context);
25  
26 {
27 no strict 'refs';
28  
29 my $class = ref $context;
30 $self->{OLD_CHECK_EOP} = \&{"${class}::check_end_of_page"};
31 *{"${class}::check_end_of_page"} = sub { return 1 };
32 }
33  
34 return 1;
35 }
36  
37 sub exit_scope
38 {
39 my $self = shift;
40 my ($context) = @_;
41  
42 {
43 no strict 'refs';
44  
45 my $class = ref $context;
46 *{"${class}::check_end_of_page"} = delete $self->{OLD_CHECK_EOP};
47 }
48  
49 @{$context}{qw/X Y/} = @{$self}{qw/OLD_X OLD_Y/};
50  
51 return $self->SUPER::exit_scope($context);
52 }
53  
54 1;
55 __END__