| 1 | ##---------------------------------------------------------------------------- | ||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/Number.pm | ||||||||||||
| 3 | ## Version v0.2.0 | ||||||||||||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||
| 6 | ## Created 2021/04/22 | ||||||||||||
| 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::Number; | ||||||||||||
| 15 | BEGIN | ||||||||||||
| 16 | 13 | ▶ | { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | 13 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 13 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 13 | warnings::register_categories( 'HTML::Object' ); | |||||||||||
| 20 | 13 | ▶ | use parent qw( Module::Generic::Number ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 13 | ▶ | use vars qw( $VERSION ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 13 | our $VERSION = 'v0.2.0'; | |||||||||||
| 23 | }; | ||||||||||||
| 24 | |||||||||||||
| 25 | 13 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 26 | 13 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 27 | |||||||||||||
| 28 | sub as_xml | ||||||||||||
| 29 | 0 | ▶ | { | ||||||||||
|
Subroutine
as_xml: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 30 | 0 | my $self = shift( @_ ); | |||||||||||
| 31 | 0 | my $n = $self->as_string; | |||||||||||
| 32 | 0 | ▶ | return( "<Number>" . ( defined( $n ) ? $n : 'NaN' ) . "</Number>\n" ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | 0 | ▶ | sub evaluate { return( $_[0] ); } | ||||||||||
|
Subroutine
evaluate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 36 | |||||||||||||
| 37 | # Return an empty hash | ||||||||||||
| 38 | 0 | ▶ | sub getAttributes { return( shift->new_hash ); } | ||||||||||
|
Subroutine
getAttributes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 39 | |||||||||||||
| 40 | # Return an empty array | ||||||||||||
| 41 | 0 | ▶ | sub getChildNodes { return( shift->new_array ); } | ||||||||||
|
Subroutine
getChildNodes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 42 | |||||||||||||
| 43 | sub isEqualNode | ||||||||||||
| 44 | 0 | ▶ | { | ||||||||||
|
Subroutine
isEqualNode: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||
| 45 | 0 | my $self = shift( @_ ); | |||||||||||
| 46 | 0 | ▶ | my $e = shift( @_ ) || return( $self->error( "No html element was provided to insert." ) ); | ||||||||||
|
Condition0%0/2
shift @_ || (return $self->error('No html element was provided to insert.'))
MC/DC0%0/1
shift @_ || (return $self->error('No html element was provided to insert.'))
shift @_
Truth table0%0/2
A
A= shift @_
| |||||||||||||
| 47 | 0 | ▶ | return( $self->error( "Element provided (", overload::StrVal( $e ), ") is not an HTML::Object::Element." ) ) if( !$self->_is_a( $e => 'HTML::Object::Element' ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 48 | 0 | ▶ | return(0) if( !$self->_is_a( $e => 'HTML::Object::Number' ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 49 | 0 | return( $self->value eq $e->value ); | |||||||||||
| 50 | } | ||||||||||||
| 51 | |||||||||||||
| 52 | 0 | ▶ | sub string_value { return( $_[0]->value ); } | ||||||||||
|
Subroutine
string_value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 53 | |||||||||||||
| 54 | sub to_boolean | ||||||||||||
| 55 | 0 | ▶ | { | ||||||||||
|
Subroutine
to_boolean: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 56 | 0 | require HTML::Object::Boolean; | |||||||||||
| 57 | 0 | ▶ | return( shift->as_string ? HTML::Object::Boolean->True : HTML::Object::Boolean->False ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 58 | } | ||||||||||||
| 59 | |||||||||||||
| 60 | 0 | ▶ | sub to_number { return( $_[0] ); } | ||||||||||
|
Subroutine
to_number: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 61 | |||||||||||||
| 62 | sub to_literal | ||||||||||||
| 63 | 0 | ▶ | { | ||||||||||
|
Subroutine
to_literal: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 64 | 0 | require HTML::Object::Literal; | |||||||||||
| 65 | 0 | return( HTML::Object::Literal->new( shift->as_string ) ); | |||||||||||
| 66 | } | ||||||||||||
| 67 | |||||||||||||
| 68 | 0 | ▶ | sub value { return( shift->as_string ); } | ||||||||||
|
Subroutine
value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 69 | |||||||||||||
| 70 | 13 | 1; | |||||||||||
| 71 | # NOTE: POD | ||||||||||||
| 72 | __END__ | ||||||||||||