@@ -1034,7 +1034,6 @@ sub splice_content {
1034
1034
my ( $self , $offset , $length , @to_add ) = @_ ;
1035
1035
Carp::croak " splice_content requires at least one argument"
1036
1036
if @_ < 2; # at least $h->splice_content($offset);
1037
- return $self unless @_ ;
1038
1037
1039
1038
my $content = ( $self -> {' _content' } ||= [] );
1040
1039
@@ -1077,7 +1076,7 @@ its parent are explicitly destroyed.
1077
1076
1078
1077
sub detach {
1079
1078
my $self = $_ [0];
1080
- return unless ( my $parent = $self -> {' _parent' } );
1079
+ return undef unless ( my $parent = $self -> {' _parent' } );
1081
1080
$self -> {' _parent' } = undef ;
1082
1081
my $cohort = $parent -> {' _content' } || return $parent ;
1083
1082
@$cohort = grep { not ( ref ($_ ) and $_ eq $self ) } @$cohort ;
@@ -1276,7 +1275,7 @@ sub delete_content {
1276
1275
1277
1276
Detaches this element from its parent (if it has one) and explicitly
1278
1277
destroys the element and all its descendants. The return value is
1279
- undef.
1278
+ the empty list (or C< undef > in scalar context) .
1280
1279
1281
1280
Before version 5.00 of HTML::Element, you had to call C<delete > when
1282
1281
you were finished with the tree, or your program would leak memory.
@@ -2603,7 +2602,7 @@ the tag names listed. You can use any mix of elements and tag names.
2603
2602
2604
2603
sub is_inside {
2605
2604
my $self = shift ;
2606
- return unless @_ ; # if no items specified, I guess this is right.
2605
+ return 0 unless @_ ; # if no items specified, I guess this is right.
2607
2606
2608
2607
my $current = $self ;
2609
2608
@@ -2667,12 +2666,12 @@ C<< $h->pindex >> returns C<undef>.
2667
2666
sub pindex {
2668
2667
my $self = shift ;
2669
2668
2670
- my $parent = $self -> {' _parent' } || return ;
2671
- my $pc = $parent -> {' _content' } || return ;
2669
+ my $parent = $self -> {' _parent' } || return undef ;
2670
+ my $pc = $parent -> {' _content' } || return undef ;
2672
2671
for ( my $i = 0; $i < @$pc ; ++$i ) {
2673
2672
return $i if ref $pc -> [$i ] and $pc -> [$i ] eq $self ;
2674
2673
}
2675
- return ; # we shouldn't ever get here
2674
+ return undef ; # we shouldn't ever get here
2676
2675
}
2677
2676
2678
2677
# --------------------------------------------------------------------------
@@ -2827,18 +2826,18 @@ sub address {
2827
2826
shift @stack ;
2828
2827
}
2829
2828
else { # absolute addressing
2830
- return unless 0 == shift @stack ; # to pop the initial 0-for-root
2829
+ return undef unless 0 == shift @stack ; # pop the initial 0-for-root
2831
2830
$here = $_ [0]-> root;
2832
2831
}
2833
2832
2834
2833
while (@stack ) {
2835
- return
2834
+ return undef
2836
2835
unless $here -> {' _content' }
2837
2836
and @{ $here -> {' _content' } } > $stack [0];
2838
2837
2839
2838
# make sure the index isn't too high
2840
2839
$here = $here -> {' _content' }[ shift @stack ];
2841
- return if @stack and not ref $here ;
2840
+ return undef if @stack and not ref $here ;
2842
2841
2843
2842
# we hit a text node when we expected a non-terminal element node
2844
2843
}
@@ -3078,7 +3077,6 @@ sub find_by_attribute {
3078
3077
return @matching ;
3079
3078
}
3080
3079
else {
3081
- return unless @matching ;
3082
3080
return $matching [0];
3083
3081
}
3084
3082
}
@@ -3653,7 +3651,6 @@ sub simplify_pres {
3653
3651
3654
3652
undef $sub ;
3655
3653
return ;
3656
-
3657
3654
}
3658
3655
3659
3656
=method-second same_as
@@ -3970,24 +3967,24 @@ sub new_from_lol {
3970
3967
3971
3968
if (wantarray ) {
3972
3969
my (@nodes ) = map { ; ( ref ($_ ) eq ' ARRAY' ) ? $sub -> ($_ ) : $_ } @_ ;
3973
-
3974
3970
# Let text bits pass thru, I guess. This makes this act more like
3975
3971
# unshift_content et al. Undocumented.
3976
- undef $sub ;
3977
3972
3973
+ undef $sub ;
3978
3974
# so it won't be in its own frame, so its refcount can hit 0
3975
+
3979
3976
return @nodes ;
3980
3977
}
3981
3978
else {
3982
3979
Carp::croak " new_from_lol in scalar context needs exactly one lol"
3983
3980
unless @_ == 1;
3984
3981
return $_ [0] unless ref ( $_ [0] ) eq ' ARRAY' ;
3985
-
3986
3982
# used to be a fatal error. still undocumented tho.
3983
+
3987
3984
$node = $sub -> ( $_ [0] );
3988
3985
undef $sub ;
3989
-
3990
3986
# so it won't be in its own frame, so its refcount can hit 0
3987
+
3991
3988
return $node ;
3992
3989
}
3993
3990
}
@@ -4099,7 +4096,7 @@ sub deobjectify_text {
4099
4096
}
4100
4097
}
4101
4098
4102
- return ;
4099
+ return undef ;
4103
4100
}
4104
4101
4105
4102
=method-second number_lists
0 commit comments