lib/HTML/Object/Number.pm

filter: Statementstmt 53.8% 21 / 39 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 41.1% 7 / 17 Podpod 100% 10 / 10 totaltotal 49.3% 38 / 77 CC 6 SCAR 17.4
CC
6
Cov
43%
isEqualNode
20.0
as_xml
6.0
to_boolean
6.0
CRAP 5.7
« lib/HTML/Object/DOM/Element/Template.pm ↑ Summary lib/HTML/Object/XPath/LocationPath.pm »
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 {
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' );
Subroutine BEGIN: called CC=1 SCAR=0.0
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 {
30 0 ▶ my $self = shift( @_ );
Subroutine as_xml: not called CC=2 SCAR=17.9
Pod documented
31 0 my $n = $self->as_string;
32 0 ▶ return( "<Number>" . ( defined( $n ) ? $n : 'NaN' ) . "</Number>\n" );
Branch: 1 branch
BranchTrueFalseTotal
defined $n ? : 0 0 0
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 {
45 0 ▶ my $self = shift( @_ );
Subroutine isEqualNode: not called CC=4 SCAR=30.0
Pod documented
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.'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No html element was provided to insert.'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
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
BranchTrueFalseTotal
unless $self->_is_a($e, "HTML::Object::Element") 0 0 0
48 0 ▶ return(0) if( !$self->_is_a( $e => 'HTML::Object::Number' ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_a($e, "HTML::Object::Number") 0 0 0
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 {
56 0 ▶ require HTML::Object::Boolean;
Subroutine to_boolean: not called CC=2 SCAR=17.9
Pod documented
57 0 ▶ return( shift->as_string ? HTML::Object::Boolean->True : HTML::Object::Boolean->False );
Branch: 1 branch
BranchTrueFalseTotal
(shift())->as_string ? : 0 0 0
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 {
64 0 ▶ require HTML::Object::Literal;
Subroutine to_literal: not called CC=1 SCAR=6.9
Pod documented
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__
« lib/HTML/Object/DOM/Element/Template.pm ↑ Summary lib/HTML/Object/XPath/LocationPath.pm »