| 1 | ##---------------------------------------------------------------------------- | ||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/Closing.pm | ||||||||||
| 3 | ## Version v0.2.0 | ||||||||||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||
| 6 | ## Created 2021/04/19 | ||||||||||
| 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::Closing; | ||||||||||
| 15 | BEGIN | ||||||||||
| 16 | { | ||||||||||
| 17 | 33 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 33 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 33 | ▶ | warnings::register_categories( 'HTML::Object' ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 33 | ▶ | use parent qw( HTML::Object::Element ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 33 | ▶ | use vars qw( $VERSION ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 33 | our $VERSION = 'v0.2.0'; | |||||||||
| 23 | }; | ||||||||||
| 24 | |||||||||||
| 25 | 33 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 33 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | sub init | ||||||||||
| 29 | { | ||||||||||
| 30 | 350 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 31 | 350 | $self->{is_empty} = 1; | |||||||||
| 32 | 350 | $self->{tag} = '_closing'; | |||||||||
| 33 | 350 | $self->{_init_strict_use_sub} = 1; | |||||||||
| 34 | 350 | $self->{_exception_class} = 'HTML::Object::Exception'; | |||||||||
| 35 | 350 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 350 | return( $self ); | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | sub as_string | ||||||||||
| 40 | { | ||||||||||
| 41 | 124 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
as_string: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 42 | 124 | my $tag = $self->tag; | |||||||||
| 43 | 124 | ▶ | return( $self->original->length ? $self->original : $self->new_scalar( "</${tag}>" ) ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | sub as_xml { return( shift->as_string( @_ ) ); } | ||||||||
|
Subroutine
as_xml: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 47 | |||||||||||
| 48 | 350 | ▶ | sub checksum { return( '' ); } | ||||||||
|
Subroutine
checksum: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 49 | |||||||||||
| 50 | ▶ | sub set_checksum {} | |||||||||
|
Subroutine
set_checksum: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 51 | |||||||||||
| 52 | 33 | 1; | |||||||||
| 53 | # NOTE: POD | ||||||||||
| 54 | __END__ | ||||||||||
| 55 | |||||||||||
| 56 | =encoding utf8 | ||||||||||
| 57 | |||||||||||
| 58 | =head1 NAME | ||||||||||
| 59 | |||||||||||
| 60 | HTML::Object::Closing - HTML Object Closing Tag Class | ||||||||||
| 61 | |||||||||||
| 62 | =head1 SYNOPSIS | ||||||||||
| 63 | |||||||||||
| 64 | use HTML::Object::Closing; | ||||||||||
| 65 | my $close = HTML::Object::Closing->new( | ||||||||||
| 66 | tag => 'div', | ||||||||||
| 67 | ); | ||||||||||
| 68 | # My opening div tag object | ||||||||||
| 69 | $elem->close_tag( $close ); | ||||||||||
| 70 | |||||||||||
| 71 | =head1 VERSION | ||||||||||
| 72 | |||||||||||
| 73 | v0.2.0 | ||||||||||
| 74 | |||||||||||
| 75 | =head1 DESCRIPTION | ||||||||||
| 76 | |||||||||||
| 77 | This module represents the end of a tag for tags that are not empty. Thos objects are in the dom by necessity, but are not used directly. They are always attached to the object of another L<HTML element|HTML::Object::Element> | ||||||||||
| 78 | |||||||||||
| 79 | This module inherits from L<HTML::Object::Element> | ||||||||||
| 80 | |||||||||||
| 81 | =head1 INHERITANCE | ||||||||||
| 82 | |||||||||||
| 83 | +-----------------------+ +-----------------------+ | ||||||||||
| 84 | | HTML::Object::Element | --> | HTML::Object::Closing | | ||||||||||
| 85 | +-----------------------+ +-----------------------+ | ||||||||||
| 86 | |||||||||||
| 87 | =head1 CONSTRUCTOR | ||||||||||
| 88 | |||||||||||
| 89 | =head2 new | ||||||||||
| 90 | |||||||||||
| 91 | Creates and returns a new tag closing object. | ||||||||||
| 92 | |||||||||||
| 93 | Creates a new C<HTML::Object::Closing> objects. | ||||||||||
| 94 | It may also take an hash like arguments, that also are method of the same name. | ||||||||||
| 95 | |||||||||||
| 96 | =head1 METHODS | ||||||||||
| 97 | |||||||||||
| 98 | On top of the methods inherited from L<HTML::Object::Element>, this module implements also the following methods: | ||||||||||
| 99 | |||||||||||
| 100 | =head2 as_string | ||||||||||
| 101 | |||||||||||
| 102 | Returns a string version of this closing tag. Unless it was modified, it will return the version exactly the same as when it was parsed from some HTML data, if any. | ||||||||||
| 103 | |||||||||||
| 104 | =head2 as_xml | ||||||||||
| 105 | |||||||||||
| 106 | This is an alias for L</as_string> | ||||||||||
| 107 | |||||||||||
| 108 | =head2 checksum | ||||||||||
| 109 | |||||||||||
| 110 | Returns an empty string. | ||||||||||
| 111 | |||||||||||
| 112 | =head2 set_checksum | ||||||||||
| 113 | |||||||||||
| 114 | Does absolutely nothing and is here to prevent the inherited method from being triggered. | ||||||||||
| 115 | |||||||||||
| 116 | =head1 AUTHOR | ||||||||||
| 117 | |||||||||||
| 118 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||||||||||
| 119 | |||||||||||
| 120 | =head1 SEE ALSO | ||||||||||
| 121 | |||||||||||
| 122 | 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> | ||||||||||
| 123 | |||||||||||
| 124 | =head1 COPYRIGHT & LICENSE | ||||||||||
| 125 | |||||||||||
| 126 | Copyright (c) 2021 DEGUEST Pte. Ltd. | ||||||||||
| 127 | |||||||||||
| 128 | All rights reserved | ||||||||||
| 129 | |||||||||||
| 130 | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||
| 131 | |||||||||||
| 132 | =cut | ||||||||||