Layout/ElementRole.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Layout/Version.pm ↑ Summary
1 #! perl
2  
3 3 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Object::Pad;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 role Text::Layout::ElementRole;
9  
10 # Implementors of this role must provide the following methods:
11  
12 3 method parse( $ctx, $el, $atts );
13 #
14 # $ctx: context (current values for font, size, etc.)
15 # $el : the elemant name, e.g. "img"
16 # $atts: anything that follows the tag, presumably atributes
17 #
18 # If the element is "<foo blar blech/>" then $el = "foo"
19 # and $atts = "bar blech".
20 #
21 # Should return a hash reference with whatever is useful.
22  
23 3 method render( $hash, $gfx, $x, $y );
24 #
25 # $hash: the hash as delivered by the parser
26 # $gfx : PDF graphics context
27 # $x : $x origin
28 # $y : $y origin
29 #
30 # Should return the advance box (array ref).
31  
32 3 method bbox( $hash );
33 #
34 # $hash: the hash as delivered by the parser
35 #
36 # Should return a hash ref with
37 # bbox : the bounding box of the image
38 # bb : the bounding box after scaling/displacement
39 # abox : the advance box
40  
41 3 1;
« Layout/Version.pm ↑ Summary