blib/lib/HTML/Object/Boolean.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 67 CC 2 SCAR 8.8
CC
2
Cov
0%
to_literal
6.0
BEGIN
2.0
getChildNodes
2.0
CRAP 2.4
1 ##----------------------------------------------------------------------------
2 ## HTML Object - ~/lib/HTML/Object/Boolean.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::Boolean;
15 BEGIN
16 {
17 use strict;
18 use warnings;
19 warnings::register_categories( 'HTML::Object' );
20 use parent qw( Module::Generic::Boolean );
21 use vars qw( $VERSION );
22 our $VERSION = 'v0.2.0';
23 };
24  
25 use strict;
26 use warnings;
27  
28 sub getChildNodes { return( shift->new_array ); }
29  
30 sub getAttributes { return( shift->new_array ); }
31  
32 sub False { return( shift->false ); }
33  
34 sub string_value { return( shift->to_literal->value ); }
35  
36 sub to_boolean { return( $_[0] ); }
37  
38 sub to_literal
39 {
40 require HTML::Object::Literal;
41 return( HTML::Object::Literal->new( shift->value ? 'true' : 'false' ) );
42 }
43  
44 sub to_number
45 {
46 require HTML::Object::Number;
47 return( HTML::Object::Number->new( shift->value ) );
48 }
49  
50 sub True { return( shift->true ); }
51  
52 sub value { return( ${$_[0]} ); }
53  
54 1;
55 # NOTE: POD
56 __END__
57  
58 =encoding utf8
59  
60 =head1 NAME
61  
62 HTML::Object::Boolean - HTML Object Boolean Class
63  
64 =head1 SYNOPSIS
65  
66 =head1 VERSION
67  
68 v0.2.0
69  
70 =head1 DESCRIPTION
71  
72 This module implements simple boolean true/false objects.
73  
74 It inherits from L<Module::Generic::Boolean>
75  
76 =head1 METHODS
77  
78 =head2 getChildNodes
79  
80 Returns and empty L<array object|Module::Generic::Array>
81  
82 =head2 getAttributes
83  
84 Returns and empty L<array object|Module::Generic::Array>
85  
86 =head2 False
87  
88 Creates a new Boolean object with a false value.
89  
90 =head2 string_value
91  
92 Returns C<true> if true, or C<false> if false
93  
94 =head2 to_boolean
95  
96 Returns the current boolean object it was called on.
97  
98 =head2 to_literal
99  
100 Returns the string "true" or "false".
101  
102 =head2 to_number
103  
104 Returns a new L<HTML::Object::Number> object based on the current boolean value.
105  
106 =head2 True
107  
108 Creates a new Boolean object with a true value.
109  
110 =head2 value
111  
112 Returns true or false.
113  
114 =head1 AUTHOR
115  
116 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
117  
118 =head1 SEE ALSO
119  
120 L<HTML::Object>, L<HTML::Object::Attribute>, L<HTML::Object::Boolean>, L<HTML::Object::Closing>, L<HTML::Object::Collection>, L<HTML::Object::Comment>, L<HTML::Object::Declaration>, L<HTML::Object::Document>, L<HTML::Object::Element>, L<HTML::Object::Exception>, L<HTML::Object::Literal>, L<HTML::Object::Number>, L<HTML::Object::Root>, L<HTML::Object::Space>, L<HTML::Object::Text>, L<HTML::Object::XQuery>
121  
122 =head1 COPYRIGHT & LICENSE
123  
124 Copyright (c) 2021 DEGUEST Pte. Ltd.
125  
126 All rights reserved
127  
128 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
129  
130 =cut