| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Element/TableRow.pm | ||||||||||||||||||||||||||||||||||||||
| 3 | ## Version v0.2.0 | ||||||||||||||||||||||||||||||||||||||
| 4 | ## Copyright(c) 2022 DEGUEST Pte. Ltd. | ||||||||||||||||||||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||||||||||||||||||||||||||||
| 6 | ## Created 2022/01/07 | ||||||||||||||||||||||||||||||||||||||
| 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::Element::TableRow; | ||||||||||||||||||||||||||||||||||||||
| 15 | BEGIN | ||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 19 | 2 | warnings::register_categories( 'HTML::Object' ); | |||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use parent qw( HTML::Object::DOM::Element ); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use vars qw( $VERSION ); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use HTML::Object::DOM::Element::Shared qw( :tablerow ); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 23 | 2 | our $VERSION = 'v0.2.0'; | |||||||||||||||||||||||||||||||||||||
| 24 | }; | ||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 27 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||
| 29 | sub init | ||||||||||||||||||||||||||||||||||||||
| 30 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 31 | 6 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 32 | 6 | $self->{_init_strict_use_sub} = 1; | |||||||||||||||||||||||||||||||||||||
| 33 | 6 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 34 | 6 | ▶ | $self->{tag} = 'tr' if( !defined( $self->{tag} ) || !CORE::length( "$self->{tag}" ) ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $self->{"tag"} and length qq[$self->{"tag"}]
MC/DC50%1/2
defined $self->{"tag"} and length qq[$self->{"tag"}]
defined $self->{"tag"}
length qq[$self->{"tag"}]
Truth table66%2/3
A and B
A= defined $self->{"tag"}B= length qq[$self->{"tag"}]
| |||||||||||||||||||||||||||||||||||||||
| 35 | 6 | $self->{_row_reset} = 1; | |||||||||||||||||||||||||||||||||||||
| 36 | my $callback = sub | ||||||||||||||||||||||||||||||||||||||
| 37 | 12 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||
| 38 | 12 | my $def = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 39 | # Our children were modified from outside our package. | ||||||||||||||||||||||||||||||||||||||
| 40 | # We need to check if it affects our rows and reset the cache accordingly | ||||||||||||||||||||||||||||||||||||||
| 41 | 12 | ▶ | unless( $def->{caller}->[0] eq ref( $self ) || | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$def->{"caller"}[0] eq ref $self or $def->{"caller"}[0] eq "HTML::Object::DOM::Element::Table"
MC/DC50%1/2
$def->{"caller"}[0] eq ref $self or $def->{"caller"}[0] eq "HTML::Object::DOM::Element::Table"
$def->{"caller"}[0] eq ref $self
$def->{"caller"}[0] eq "HTML::Object::DOM::Element::Table"
Truth table66%2/3
A or B
A= $def->{"caller"}[0] eq ref $selfB= $def->{"caller"}[0] eq "HTML::Object::DOM::Element::Table"
| |||||||||||||||||||||||||||||||||||||||
| 42 | $def->{caller}->[0] eq 'HTML::Object::DOM::Element::Table' ) | ||||||||||||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||||||||||||
| 44 | 11 | $self->reset(1); | |||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||
| 46 | 12 | return(1); | |||||||||||||||||||||||||||||||||||||
| 47 | 6 | }; | |||||||||||||||||||||||||||||||||||||
| 48 | 6 | $self->children->callback( add => $callback ); | |||||||||||||||||||||||||||||||||||||
| 49 | 6 | $self->children->callback( remove => $callback ); | |||||||||||||||||||||||||||||||||||||
| 50 | 6 | return( $self ); | |||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||
| 53 | # Note: deprecated property align is inherited | ||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||
| 55 | # Note: deprecated property bgColor | ||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub bgColor : lvalue { return( shift->_set_get_property( 'bgcolor', @_ ) ); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
bgColor: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub bgcolor : lvalue { return( shift->bgColor( @_ ) ); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
bgcolor: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||
| 60 | # Note: property cells read-only | ||||||||||||||||||||||||||||||||||||||
| 61 | sub cells | ||||||||||||||||||||||||||||||||||||||
| 62 | 65 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
cells: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 63 | 65 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 64 | 65 | ▶ | return( $self->{_row_cells} ) if( $self->{_row_cells} && !$self->_is_row_reset ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"_row_cells"} and not $self->_is_row_reset
MC/DC100%2/2
$self->{"_row_cells"} and not $self->_is_row_reset
$self->{"_row_cells"}
not $self->_is_row_reset
Truth table100%3/3
A and not(B)
A= $self->{"_row_cells"}B= not $self->_is_row_reset
| |||||||||||||||||||||||||||||||||||||||
| 65 | 62 | ▶ | my $list = $self->children->grep(sub{ $self->_is_a( $_ => 'HTML::Object::DOM::Element::TableCell' ) }); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 66 | # The content of the collection is refreshed, but the collection object itself does not change, so the user can poll it | ||||||||||||||||||||||||||||||||||||||
| 67 | 62 | ▶ | unless( $self->{_row_cells} ) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||||||||||||
| 69 | 6 | ▶ | $self->_load_class( 'HTML::Object::DOM::Collection' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 70 | 6 | ▶ | $self->{_row_cells} = HTML::Object::DOM::Collection->new || | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Collection'->new || (return $self->pass_error('HTML::Object::DOM::Collection'->error))
MC/DC0%0/1
'HTML::Object::DOM::Collection'->new || (return $self->pass_error('HTML::Object::DOM::Collection'->error))
'HTML::Object::DOM::Collection'->new
Truth table50%1/2
A
A= 'HTML::Object::DOM::Collection'->new
| |||||||||||||||||||||||||||||||||||||||
| 71 | return( $self->pass_error( HTML::Object::DOM::Collection->error ) ); | ||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||
| 73 | 62 | $self->{_row_cells}->set( $list ); | |||||||||||||||||||||||||||||||||||||
| 74 | 62 | $self->_remove_row_reset; | |||||||||||||||||||||||||||||||||||||
| 75 | 62 | return( $self->{_row_cells} ); | |||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||
| 78 | # Note: deprecated property ch | ||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub ch : lvalue { return( shift->_set_get_property( 'ch', @_ ) ); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
ch: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||
| 81 | # Note: deprecated property chOff | ||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub chOff : lvalue { return( shift->_set_get_property( 'choff', @_ ) ); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
chOff: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub choff : lvalue { return( shift->chOff( @_ ) ); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
choff: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||
| 86 | sub deleteCell | ||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteCell: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 89 | 0 | my $pos = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
defined $pos and $self->_is_integer($pos)
$pos // ""
MC/DC0%0/2
defined $pos and $self->_is_integer($pos)
defined $pos
$self->_is_integer($pos)
MC/DC0%0/1
$pos // ""
$pos
Truth table0%0/3
A and B
A= defined $posB= $self->_is_integer($pos)
Truth table0%0/2
A
A= $pos
| |||||||||||||||||||||||||||||||||||||||
| 91 | message => "Value provided (" . overload::StrVal( $pos // '' ) . ") is not an integer.", | ||||||||||||||||||||||||||||||||||||||
| 92 | class => 'HTML::Object::IndexSizeError', | ||||||||||||||||||||||||||||||||||||||
| 93 | }) ) if( !defined( $pos ) || !$self->_is_integer( $pos ) ); | ||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my $cells = $self->cells; | |||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $size = $cells->cells; | |||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 97 | message => "Value provided ($pos) is greater than the zero-based number of cells available (${size}).", | ||||||||||||||||||||||||||||||||||||||
| 98 | class => 'HTML::Object::IndexSizeError', | ||||||||||||||||||||||||||||||||||||||
| 99 | }) ) if( $pos > $size ); | ||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pos < 0 and abs $pos > $size
MC/DC0%0/2
$pos < 0 and abs $pos > $size
$pos < 0
abs $pos > $size
Truth table0%0/3
A and B
A= $pos < 0B= abs $pos > $size
| |||||||||||||||||||||||||||||||||||||||
| 101 | message => "Value provided ($pos) is lower than the zero-based number of cells available (${size}). If you want to specify a negative index, it must be between -1 and -${size}", | ||||||||||||||||||||||||||||||||||||||
| 102 | class => 'HTML::Object::IndexSizeError', | ||||||||||||||||||||||||||||||||||||||
| 103 | }) ) if( $pos < 0 && abs( $pos ) > $size ); | ||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | $pos = ( $cells->length + $pos ) if( $pos < 0 ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $elem = $cells->index( $pos ); | |||||||||||||||||||||||||||||||||||||
| 106 | 0 | my $children = $self->children; | |||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $kid_pos = $children->pos( $elem ); | |||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 109 | message => "Unable to find the cell element among this row children!", | ||||||||||||||||||||||||||||||||||||||
| 110 | class => 'HTML::Object::HierarchyRequestError', | ||||||||||||||||||||||||||||||||||||||
| 111 | }) ) if( !defined( $kid_pos ) ); | ||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $children->splice( $kid_pos, 1 ); | |||||||||||||||||||||||||||||||||||||
| 113 | 0 | $elem->parent( undef ); | |||||||||||||||||||||||||||||||||||||
| 114 | 0 | $self->reset(1); | |||||||||||||||||||||||||||||||||||||
| 115 | 0 | return( $elem ); | |||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||
| 118 | sub insertCell | ||||||||||||||||||||||||||||||||||||||
| 119 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
insertCell: called CC=14 SCAR=42.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 120 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 121 | 1 | my $pos = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 122 | 1 | my $cells = $self->cells; | |||||||||||||||||||||||||||||||||||||
| 123 | 1 | my $size = $cells->size; | |||||||||||||||||||||||||||||||||||||
| 124 | 1 | ▶ | if( defined( $pos ) ) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$pos // ""
MC/DC0%0/1
$pos // ""
$pos
Truth table0%0/2
A
A= $pos
| |||||||||||||||||||||||||||||||||||||||
| 127 | message => "Value provided (" . overload::StrVal( $pos // '' ) . ") is not an integer.", | ||||||||||||||||||||||||||||||||||||||
| 128 | class => 'HTML::Object::IndexSizeError', | ||||||||||||||||||||||||||||||||||||||
| 129 | }) ) if( !$self->_is_integer( $pos ) ); | ||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 131 | message => "Value provided ($pos) is greater than the zero-based number of cells available (${size}).", | ||||||||||||||||||||||||||||||||||||||
| 132 | class => 'HTML::Object::IndexSizeError', | ||||||||||||||||||||||||||||||||||||||
| 133 | }) ) if( $pos > $size ); | ||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pos < 0 and abs $pos > $size
MC/DC0%0/2
$pos < 0 and abs $pos > $size
$pos < 0
abs $pos > $size
Truth table0%0/3
A and B
A= $pos < 0B= abs $pos > $size
| |||||||||||||||||||||||||||||||||||||||
| 135 | message => "Value provided ($pos) is lower than the zero-based number of cells available (${size}). If you want to specify a negative index, it must be between -1 and -${size}", | ||||||||||||||||||||||||||||||||||||||
| 136 | class => 'HTML::Object::IndexSizeError', | ||||||||||||||||||||||||||||||||||||||
| 137 | }) ) if( $pos < 0 && abs( $pos ) > $size ); | ||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | $pos = ( $cells->length + $pos ) if( $pos < 0 ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||
| 140 | 1 | ▶ | $self->_load_class( 'HTML::Object::DOM::Element::TableCell' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 141 | 1 | my $children = $self->children; | |||||||||||||||||||||||||||||||||||||
| 142 | 1 | ▶ | my $cell = HTML::Object::DOM::Element::TableCell->new( @_ ) || | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Element::TableCell'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Element::TableCell'->error))
MC/DC0%0/1
'HTML::Object::DOM::Element::TableCell'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Element::TableCell'->error))
'HTML::Object::DOM::Element::TableCell'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Element::TableCell'->new(@_)
| |||||||||||||||||||||||||||||||||||||||
| 143 | return( $self->pass_error( HTML::Object::DOM::Element::TableCell->error ) ); | ||||||||||||||||||||||||||||||||||||||
| 144 | 1 | $cell->close; | |||||||||||||||||||||||||||||||||||||
| 145 | # A position was provided | ||||||||||||||||||||||||||||||||||||||
| 146 | 1 | ▶ | if( defined( $pos ) ) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 147 | { | ||||||||||||||||||||||||||||||||||||||
| 148 | # ..., but there are no cells yet | ||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if( $cells->is_empty ) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 150 | { | ||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $children->push( $cell ); | |||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||
| 153 | else | ||||||||||||||||||||||||||||||||||||||
| 154 | { | ||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $elem = $cells->index( $pos ); | |||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 157 | message => "No element could be found at row index $pos", | ||||||||||||||||||||||||||||||||||||||
| 158 | class => 'HTML::Object::HierarchyRequestError', | ||||||||||||||||||||||||||||||||||||||
| 159 | }) ) if( !defined( $elem ) ); | ||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my $kid_pos = $children->pos( $elem ); | |||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if( !defined( $kid_pos ) ) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 162 | { | ||||||||||||||||||||||||||||||||||||||
| 163 | 0 | return( $self->error({ | |||||||||||||||||||||||||||||||||||||
| 164 | message => "Could not find a value at offset $pos (translated to $kid_pos among the row children) amazingly enough.", | ||||||||||||||||||||||||||||||||||||||
| 165 | class => 'HTML::Object::HierarchyRequestError', | ||||||||||||||||||||||||||||||||||||||
| 166 | }) ); | ||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $children->splice( $kid_pos, 0, $cell ); | |||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||
| 171 | # otherwise, there are already other cells directly under <tr> and the new cell is just added at the end of the row. | ||||||||||||||||||||||||||||||||||||||
| 172 | else | ||||||||||||||||||||||||||||||||||||||
| 173 | { | ||||||||||||||||||||||||||||||||||||||
| 174 | 1 | $children->push( $cell ); | |||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||
| 176 | 1 | $cell->parent( $self ); | |||||||||||||||||||||||||||||||||||||
| 177 | 1 | $self->reset(1); | |||||||||||||||||||||||||||||||||||||
| 178 | 1 | return( $cell ); | |||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||
| 181 | sub reset | ||||||||||||||||||||||||||||||||||||||
| 182 | 230 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 183 | 230 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 184 | 230 | ▶ | if( scalar( @_ ) ) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 185 | { | ||||||||||||||||||||||||||||||||||||||
| 186 | 62 | $self->_reset_row; | |||||||||||||||||||||||||||||||||||||
| 187 | 62 | return( $self->SUPER::reset( @_ ) ); | |||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||
| 189 | 168 | return( $self ); | |||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||
| 192 | # Note: property rowIndex read-only | ||||||||||||||||||||||||||||||||||||||
| 193 | sub rowIndex | ||||||||||||||||||||||||||||||||||||||
| 194 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
rowIndex: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 195 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 196 | 1 | ▶ | my $parent = $self->parent || return; | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->parent || (return)
MC/DC0%0/1
$self->parent || (return)
$self->parent
Truth table50%1/2
A
A= $self->parent
| |||||||||||||||||||||||||||||||||||||||
| 197 | 1 | my $siblings = $parent->children; | |||||||||||||||||||||||||||||||||||||
| 198 | 1 | my $pos = $siblings->pos( $self ); | |||||||||||||||||||||||||||||||||||||
| 199 | 1 | return( $pos ); | |||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||
| 202 | # Note: property sectionRowIndex read-only | ||||||||||||||||||||||||||||||||||||||
| 203 | sub sectionRowIndex | ||||||||||||||||||||||||||||||||||||||
| 204 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
sectionRowIndex: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 205 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 206 | 1 | ▶ | my $parent = $self->parent || return; | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->parent || (return)
MC/DC0%0/1
$self->parent || (return)
$self->parent
Truth table50%1/2
A
A= $self->parent
| |||||||||||||||||||||||||||||||||||||||
| 207 | 1 | ▶ | if( $self->_is_a( $parent => 'HTML::Object::DOM::Element::TableSection' ) ) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 208 | { | ||||||||||||||||||||||||||||||||||||||
| 209 | 1 | return( $parent->children->pos( $self ) ); | |||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||
| 211 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||
| 214 | # Note: deprecated property vAlign | ||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | sub vAlign : lvalue { return( shift->_set_get_property( 'valign', @_ ) ); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
vAlign: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub valign : lvalue { return( shift->vAlign( @_ ) ); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
valign: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||
| 219 | 59 | ▶ | sub _is_row_reset { return( CORE::length( shift->{_row_reset} ) ); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_row_reset: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||
| 221 | 62 | ▶ | sub _remove_row_reset { return( CORE::delete( shift->{_row_reset} ) ); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_remove_row_reset: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||
| 223 | sub _reset_row | ||||||||||||||||||||||||||||||||||||||
| 224 | 62 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_reset_row: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||
| 225 | 62 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||
| 226 | 62 | $self->{_row_reset}++; | |||||||||||||||||||||||||||||||||||||
| 227 | # Force it to recompute | ||||||||||||||||||||||||||||||||||||||
| 228 | 62 | $self->cells; | |||||||||||||||||||||||||||||||||||||
| 229 | 62 | ▶ | if( my $parent = $self->parent ) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 230 | { | ||||||||||||||||||||||||||||||||||||||
| 231 | 50 | ▶ | $parent->_reset_section if( $parent->can( '_reset_section' ) ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||
| 233 | 62 | return( $self ); | |||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||
| 236 | 2 | 1; | |||||||||||||||||||||||||||||||||||||
| 237 | # NOTE: POD | ||||||||||||||||||||||||||||||||||||||
| 238 | __END__ | ||||||||||||||||||||||||||||||||||||||