| 1 | package HTML::ElementRaw; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # Allow raw html as content so that special characters | ||||||||||||||||||||
| 4 | # do not get encoded. The string is incorporated as part | ||||||||||||||||||||
| 5 | # of the start tag in order to bypass the regular HTML::Element | ||||||||||||||||||||
| 6 | # encoding. | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | ▶ | use vars qw($VERSION @ISA); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | require HTML::Element; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | @ISA = qw(HTML::Element); | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 1 | $VERSION = '1.18'; | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | # Whole lotta overrides | ||||||||||||||||||||
| 18 | # | ||||||||||||||||||||
| 19 | # Have to store the string somewhere besides _content, because | ||||||||||||||||||||
| 20 | # traverse looks in the attribute directly rather than calling | ||||||||||||||||||||
| 21 | # content(). | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 0 | ▶ | sub push_content { | ||||||||||||||||||
|
Subroutine
push_content: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 24 | # Flatten elements into an HTML string if found, | ||||||||||||||||||||
| 25 | # otherwise just slap the text in. | ||||||||||||||||||||
| 26 | 0 | ▶ | my @text = map(defined (ref $_ ? $_->as_HTML : $_) ? $_ : '', @_); | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 27 | 0 | shift->{_string}[0] .= join('',@text); | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | 0 | ▶ | sub insert_element { | ||||||||||||||||||
|
Subroutine
insert_element: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 30 | 0 | push_content(@_); | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | 0 | ▶ | sub starttag { | ||||||||||||||||||
|
Subroutine
starttag: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 33 | 0 | shift->{_string}[0]; | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | 0 | ▶ | sub as_HTML { | ||||||||||||||||||
|
Subroutine
as_HTML: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 36 | 0 | starttag(@_); | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | # These become degenerate | ||||||||||||||||||||
| 40 | 0 | ▶ | sub endtag { return } | ||||||||||||||||||
|
Subroutine
endtag: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 41 | 0 | ▶ | sub pos { return } | ||||||||||||||||||
|
Subroutine
pos: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 42 | 0 | ▶ | sub attr { return } | ||||||||||||||||||
|
Subroutine
attr: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 43 | 0 | ▶ | sub content { return } | ||||||||||||||||||
|
Subroutine
content: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 44 | 0 | ▶ | sub tag { return } | ||||||||||||||||||
|
Subroutine
tag: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 47 | 0 | my $that = shift; | |||||||||||||||||||
| 48 | 0 | ▶ | my $class = ref($that) || $that; | ||||||||||||||||||
|
Condition0%0/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 49 | # The tag type does not get displayed. We keep it | ||||||||||||||||||||
| 50 | # around anyway, just in case. | ||||||||||||||||||||
| 51 | 0 | ▶ | my @args = @_ ? @_ : 'p'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 52 | 0 | my $self = new HTML::Element @args; | |||||||||||||||||||
| 53 | 0 | bless $self,$class; | |||||||||||||||||||
| 54 | 0 | $self; | |||||||||||||||||||
| 55 | } | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 1 | 1; | |||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||