| 1 | ##---------------------------------------------------------------------------- | ||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/Space.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::Space; | ||||||||||
| 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 | 505 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 31 | 505 | $self->{is_empty} = 1; | |||||||||
| 32 | 505 | $self->{tag} = '_space'; | |||||||||
| 33 | 505 | $self->{value} = undef; | |||||||||
| 34 | 505 | $self->{_init_strict_use_sub} = 1; | |||||||||
| 35 | 505 | $self->{_exception_class} = 'HTML::Object::Exception'; | |||||||||
| 36 | 505 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 505 | return( $self ); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | sub as_string | ||||||||||
| 41 | { | ||||||||||
| 42 | 159 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
as_string: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 43 | # We need to remove the reset flag, otherwise if there are any subsequent change that need to be propagated to this space parent, HTML::Object::Element::reset will not propagate it | ||||||||||
| 44 | 159 | $self->_remove_reset; | |||||||||
| 45 | 159 | ▶ | return( $self->value->length ? $self->value : $self->original ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub as_xml { return( shift->as_string( @_ ) ); } | ||||||||
|
Subroutine
as_xml: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 49 | |||||||||||
| 50 | sub set_checksum | ||||||||||
| 51 | { | ||||||||||
| 52 | 505 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
set_checksum: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 53 | 505 | return( $self->_get_md5_hash( $self->value->scalar ) ); | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 1576 | ▶ | sub value : lvalue { return( shift->_set_get_scalar_as_object( 'value', @_ ) ); } | ||||||||
|
Subroutine
value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 57 | # { | ||||||||||
| 58 | # my $self = shift( @_ ); | ||||||||||
| 59 | # if( @_ ) | ||||||||||
| 60 | # { | ||||||||||
| 61 | # return( $self->_set_get_scalar_as_object( 'value', @_ ) ); | ||||||||||
| 62 | # } | ||||||||||
| 63 | # my $val = $self->_set_get_scalar_as_object( 'value' ); | ||||||||||
| 64 | # return( $val ) if( defined( $val ) && $val->defined ); | ||||||||||
| 65 | # return( $self->original ); | ||||||||||
| 66 | # } | ||||||||||
| 67 | |||||||||||
| 68 | 36 | 1; | |||||||||
| 69 | # NOTE: POD | ||||||||||
| 70 | __END__ | ||||||||||