lib/HTML/Object/DOM/Boolean.pm

filter: Statementstmt 70.0% 21 / 30 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.0% 7 / 10 Podpod 100% 3 / 3 totaltotal 60.7% 31 / 51 CC 5 SCAR 15.7
CC
5
Cov
55%
init
12.0
toString
6.0
valueOf
6.0
CRAP 4.8
« lib/HTML/Object/DOM/Closing.pm ↑ Summary blib/lib/HTML/Object/DOM/VideoTrack.pm »
1 ##----------------------------------------------------------------------------
2 ## HTML Object - ~/lib/HTML/Object/DOM/Boolean.pm
3 ## Version v0.2.0
4 ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2021/12/13
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::DOM::Boolean;
15 BEGIN
16 {
17 7 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 7 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 7 ▶ warnings::register_categories( 'HTML::Object' );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 7 ▶ use parent qw( Module::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 7 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
22 7 our $VERSION = 'v0.2.0';
23 };
24  
25 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 sub init
29 {
30 0 ▶ my $self = shift( @_ );
Subroutine init: not called CC=3 SCAR=24.8
Pod documented
31 0 my $bool = shift( @_ );
32 0 $self->{value} = $bool;
33 0 $self->{_init_strict_use_sub} = 1;
34 0 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 0 0 0
35 0 ▶ $self->{value} = $self->{value} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'value'} ? : 0 0 0
36 0 return( $self );
37 }
38  
39 0 ▶sub toString { return( shift->{value} ? 'true' : 'false' ); }
Subroutine toString: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->{'value'} ? : 0 0 0
40  
41 0 ▶sub valueOf { return( shift->{value} ? 1 : 0 ); }
Subroutine valueOf: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->{'value'} ? : 0 0 0
42  
43 7 1;
44 # NOTE: POD
45 __END__
46  
47 =encoding utf-8
48  
49 =head1 NAME
50  
51 HTML::Object::DOM::Boolean - HTML Object DOM Boolean
52  
53 =head1 SYNOPSIS
54  
55 use HTML::Object::DOM::Boolean;
56 my $bool = HTML::Object::DOM::Boolean->new(1) ||
57 die( HTML::Object::DOM::Boolean->error, "\n" );
58 say $bool->toString;
59 say $bool->valueOf;
60  
61 =head1 VERSION
62  
63 v0.2.0
64  
65 =head1 DESCRIPTION
66  
67 This implements an object wrapper for a boolean value.
68  
69 The value passed as the first parameter is converted to a boolean value, if necessary. If the value is omitted or is C<0>, C<-0>, C<undef>, or the empty string (""), the object has an initial value of false (i.e. C<0> in perl). All other values, including any object, an empty array ([]), or the string "false", create an object with an initial value of true (i.e. C<1> in perl).
70  
71 =head1 METHODS
72  
73 =head2 toString
74  
75 Returns a string of either C<true> or C<false> depending upon the value of the object.
76  
77 =head2 valueOf
78  
79 Returns the primitive value of the Boolean object, i.e. C<0> for false, or C<1> for true.
80  
81 =head1 AUTHOR
82  
83 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
84  
85 =head1 SEE ALSO
86  
87 L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean>
88  
89 =head1 COPYRIGHT & LICENSE
90  
91 Copyright(c) 2021 DEGUEST Pte. Ltd.
92  
93 All rights reserved
94  
95 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
96  
97 =cut
« lib/HTML/Object/DOM/Closing.pm ↑ Summary blib/lib/HTML/Object/DOM/VideoTrack.pm »