Object/Declaration.pm

filter: Statementstmt 75.0% 30 / 40 Branchbran 20.0% 2 / 10 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 76.9% 10 / 13 Podpod 100% 6 / 6 totaltotal 62.0% 49 / 79 CC 8 SCAR 17.9
CC
8
Cov
59%
as_string
20.0
name
6.0
init
4.3
CRAP 6.0
« Object/DOM/AudioTrack.pm ↑ Summary Object/DOM/File.pm »
1 ##----------------------------------------------------------------------------
2 ## HTML Object - ~/lib/HTML/Object/Declaration.pm
3 ## Version v0.2.0
4 ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2021/04/19
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::Declaration;
15 BEGIN
16 36 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
17 36 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 36 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 36 warnings::register_categories( 'HTML::Object' );
20 36 ▶ use parent qw( HTML::Object::Element );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 36 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
22 36 our $VERSION = 'v0.2.0';
23 };
24  
25 36 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 36 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 sub init
29 28 ▶{
Subroutine init: called CC=4 SCAR=14.6
Pod documented
30 28 my $self = shift( @_ );
31 28 $self->{is_empty} = 1;
32 28 ▶ $self->{name} = 'html' unless( CORE::exists( $self->{name} ) && CORE::length( $self->{name} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"name"} and length $self->{"name"} 0 28 28
Condition33%1/3
exists $self->{"name"} and length $self->{"name"}
!ll&&!rl&&r
0028
MC/DC0%0/2
exists $self->{"name"} and length $self->{"name"}
exists $self->{"name"} length $self->{"name"}
Truth table33%1/3
A and B
A= exists $self->{"name"}B= length $self->{"name"}
ABresult
0X0
100
111
33 28 $self->{_init_strict_use_sub} = 1;
34 28 $self->{_exception_class} = 'HTML::Object::Exception';
35 28 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 28 0 28
36 28 $self->{tag} = '_declaration';
37 28 return( $self );
38 }
39  
40 sub as_string
41 0 ▶{
Subroutine as_string: not called CC=4 SCAR=30.0
Pod documented
42 0 my $self = shift( @_ );
43 0 ▶ if( !$self->original->is_empty )
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->original->is_empty) { } 0 0 0
44 {
45 0 return( $self->original );
46 }
47 else
48 {
49 0 my $name = $self->name;
50 0 ▶ return( $self->new_scalar( "<!DOCTYPE" . ( ( defined( $name ) && CORE::length( "$name" ) ) ? " ${name}" : '' ) . '>' ) );
Branch: 1 branch
BranchTrueFalseTotal
defined $name && length "$name" ? : 0 0 0
Condition0%0/3
defined $name and length "$name"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $name and length "$name"
defined $name length "$name"
Truth table0%0/3
A and B
A= defined $nameB= length "$name"
ABresult
0X0
100
111
51 }
52 }
53  
54 0 ▶sub as_xml { return( shift->as_string( @_ ) ); }
Subroutine as_xml: not called CC=1 SCAR=6.9
Pod documented
55  
56 28 ▶sub checksum { return( '' ); }
Subroutine checksum: called CC=1 SCAR=0.0
Pod documented
57  
58 sub name
59 0 ▶{
Subroutine name: not called CC=2 SCAR=17.9
Pod documented
60 0 my $self = shift( @_ );
61 0 ▶ if( my $rv = $self->original->match( qr/^<!DOCTYPE[[:blank:]\h]+(\w+)/ ) )
Branch: 1 branch
BranchTrueFalseTotal
if (my $rv = $self->original->match(qr/^<!DOCTYPE[[:blank:]\h]+(\w+)/)) 0 0 0
62 {
63 0 return( lc( $rv->capture->first ) );
64 }
65 0 return( '' );
66 }
67  
68 28 ▶sub set_checksum {}
Subroutine set_checksum: called CC=1 SCAR=0.0
Pod documented
69  
70 36 1;
71 # NOTE: POD
72 __END__
« Object/DOM/AudioTrack.pm ↑ Summary Object/DOM/File.pm »