| 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 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 1 | ▶ | warnings::register_categories( 'HTML::Object' ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 1 | ▶ | use parent qw( Module::Generic::Boolean ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 1 | ▶ | use vars qw( $VERSION ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 1 | our $VERSION = 'v0.2.0'; | |||||||||
| 23 | }; | ||||||||||
| 24 | |||||||||||
| 25 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub getChildNodes { return( shift->new_array ); } | ||||||||
|
Subroutine
getChildNodes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | sub getAttributes { return( shift->new_array ); } | ||||||||
|
Subroutine
getAttributes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | sub False { return( shift->false ); } | ||||||||
|
Subroutine
False: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | sub string_value { return( shift->to_literal->value ); } | ||||||||
|
Subroutine
string_value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | sub to_boolean { return( $_[0] ); } | ||||||||
|
Subroutine
to_boolean: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 37 | |||||||||||
| 38 | sub to_literal | ||||||||||
| 39 | { | ||||||||||
| 40 | 0 | ▶ | require HTML::Object::Literal; | ||||||||
|
Subroutine
to_literal: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 41 | 0 | ▶ | return( HTML::Object::Literal->new( shift->value ? 'true' : 'false' ) ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | sub to_number | ||||||||||
| 45 | { | ||||||||||
| 46 | 0 | ▶ | require HTML::Object::Number; | ||||||||
|
Subroutine
to_number: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 47 | 0 | return( HTML::Object::Number->new( shift->value ) ); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub True { return( shift->true ); } | ||||||||
|
Subroutine
True: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | sub value { return( ${$_[0]} ); } | ||||||||
|
Subroutine
value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 53 | |||||||||||
| 54 | 1 | 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 | ||||||||||