| 1 | ##---------------------------------------------------------------------------- | ||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Element/Template.pm | ||||||||||||
| 3 | ## Version v0.2.0 | ||||||||||||
| 4 | ## Copyright(c) 2022 DEGUEST Pte. Ltd. | ||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||
| 6 | ## Created 2022/01/09 | ||||||||||||
| 7 | ## Modified 2022/09/18 | ||||||||||||
| 8 | ## All rights reserved. | ||||||||||||
| 9 | ## | ||||||||||||
| 10 | ## | ||||||||||||
| 11 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||||
| 12 | ## under the same terms as Perl itself. | ||||||||||||
| 13 | ##---------------------------------------------------------------------------- | ||||||||||||
| 14 | package HTML::Object::DOM::Element::Template; | ||||||||||||
| 15 | BEGIN | ||||||||||||
| 16 | { | ||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 1 | ▶ | warnings::register_categories( 'HTML::Object' ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | 1 | ▶ | use parent qw( HTML::Object::DOM::Element ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 1 | ▶ | use vars qw( $VERSION ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 1 | our $VERSION = 'v0.2.0'; | |||||||||||
| 23 | }; | ||||||||||||
| 24 | |||||||||||||
| 25 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 26 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 27 | |||||||||||||
| 28 | sub init | ||||||||||||
| 29 | { | ||||||||||||
| 30 | 0 | ▶ | my $self = shift( @_ ); | ||||||||||
|
Subroutine
init: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 31 | 0 | $self->{_init_strict_use_sub} = 1; | |||||||||||
| 32 | 0 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | 0 | ▶ | $self->{tag} = 'template' if( !CORE::length( "$self->{tag}" ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | 0 | return( $self ); | |||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | # Note: property content read-only | ||||||||||||
| 38 | sub content : lvalue { return( shift->_lvalue({ | ||||||||||||
| 39 | set => sub | ||||||||||||
| 40 | { | ||||||||||||
| 41 | 0 | ▶ | my $self = shift( @_ ); | ||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||
| 42 | 0 | my $ref = shift( @_ ); | |||||||||||
| 43 | 0 | ▶ | my $nodes = $self->_list_to_nodes( @$ref ) || | ||||||||||
|
Condition0%0/2
$self->_list_to_nodes(@$ref) || (return $self->pass_error)
MC/DC0%0/1
$self->_list_to_nodes(@$ref) || (return $self->pass_error)
$self->_list_to_nodes(@$ref)
Truth table0%0/2
A
A= $self->_list_to_nodes(@$ref)
| |||||||||||||
| 44 | return( $self->pass_error ); | ||||||||||||
| 45 | 0 | for( @$nodes ) | |||||||||||
| 46 | { | ||||||||||||
| 47 | 0 | $_->detach; | |||||||||||
| 48 | 0 | $_->parent( $self ); | |||||||||||
| 49 | } | ||||||||||||
| 50 | 0 | my $children = $self->children; | |||||||||||
| 51 | 0 | $children->set( $nodes ); | |||||||||||
| 52 | 0 | return( $self ); | |||||||||||
| 53 | }, | ||||||||||||
| 54 | get => sub | ||||||||||||
| 55 | { | ||||||||||||
| 56 | 0 | ▶ | my $self = shift( @_ ); | ||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||
| 57 | 0 | ▶ | $self->_load_class( 'HTML::Object::DOM::DocumentFragment' ) || | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 58 | return( $self->pass_error ); | ||||||||||||
| 59 | 0 | my $children = $self->children; | |||||||||||
| 60 | 0 | my $frag = HTML::Object::DOM::DocumentFragment->new; | |||||||||||
| 61 | 0 | $frag->children->set( $children ); | |||||||||||
| 62 | 0 | return( $frag ); | |||||||||||
| 63 | } | ||||||||||||
| 64 | 0 | ▶ | }, @_ ) ); } | ||||||||||
|
Subroutine
content: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 65 | |||||||||||||
| 66 | 1 | 1; | |||||||||||
| 67 | # NOTE: POD | ||||||||||||
| 68 | __END__ | ||||||||||||