blib/lib/HTML/Object/DOM/Element/Template.pm untested

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 63 CC 2 SCAR 10.3
CC
2
Cov
0%
init
6.0
BEGIN
2.0
content
2.0
CRAP 2.8
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 use strict;
18 use warnings;
19 warnings::register_categories( 'HTML::Object' );
20 use parent qw( HTML::Object::DOM::Element );
21 use vars qw( $VERSION );
22 our $VERSION = 'v0.2.0';
23 };
24  
25 use strict;
26 use warnings;
27  
28 sub init
29 {
30 my $self = shift( @_ );
31 $self->{_init_strict_use_sub} = 1;
32 $self->SUPER::init( @_ ) || return( $self->pass_error );
33 $self->{tag} = 'template' if( !CORE::length( "$self->{tag}" ) );
34 return( $self );
35 }
36  
37 # Note: property content read-only
38 sub content : lvalue { return( shift->_lvalue({
39 set => sub
40 {
41 my $self = shift( @_ );
42 my $ref = shift( @_ );
43 my $nodes = $self->_list_to_nodes( @$ref ) ||
44 return( $self->pass_error );
45 for( @$nodes )
46 {
47 $_->detach;
48 $_->parent( $self );
49 }
50 my $children = $self->children;
51 $children->set( $nodes );
52 return( $self );
53 },
54 get => sub
55 {
56 my $self = shift( @_ );
57 $self->_load_class( 'HTML::Object::DOM::DocumentFragment' ) ||
58 return( $self->pass_error );
59 my $children = $self->children;
60 my $frag = HTML::Object::DOM::DocumentFragment->new;
61 $frag->children->set( $children );
62 return( $frag );
63 }
64 }, @_ ) ); }
65  
66 1;
67 # NOTE: POD
68 __END__