| 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 | { | ||||||||||||||||||||||||||||
| 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' ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 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 | { | ||||||||||||||||||||||||||||
| 30 | 28 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 28 | $self->{is_empty} = 1; | |||||||||||||||||||||||||||
| 32 | 28 | ▶ | $self->{name} = 'html' unless( CORE::exists( $self->{name} ) && CORE::length( $self->{name} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"name"} and length $self->{"name"}
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"}
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 36 | 28 | $self->{tag} = '_declaration'; | |||||||||||||||||||||||||||
| 37 | 28 | return( $self ); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | sub as_string | ||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||
| 42 | 0 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
as_string: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if( !$self->original->is_empty ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
defined $name and length "$name"
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"
| |||||||||||||||||||||||||||||
| 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 | { | ||||||||||||||||||||||||||||
| 60 | 0 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
name: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if( my $rv = $self->original->match( qr/^<!DOCTYPE[[:blank:]\h]+(\w+)/ ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||
| 63 | 0 | return( lc( $rv->capture->first ) ); | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | 0 | return( '' ); | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | ▶ | sub set_checksum {} | |||||||||||||||||||||||||||
|
Subroutine
set_checksum: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 36 | 1; | |||||||||||||||||||||||||||
| 71 | # NOTE: POD | ||||||||||||||||||||||||||||
| 72 | __END__ | ||||||||||||||||||||||||||||