if ($x and ! $y) { ... } elsif (!$x and $y) { ... } else { ... } #### 1 sub _synch_arrays { 2 # if the method is called from a token generated by the get_tag() method, 3 # the returned array reference will be identical to a start or end tag 4 # token returned by get_token() *except* the first element in the reference 5 # will not be an identifier like 'S' or 'E' 6 7 my $array_ref = shift; 8 my $tag_func = GET_TOKEN; 9 10 unless ( grep { $array_ref->[0] eq $_ } keys %token ) { 11 # created with get_tag() method, so we need 12 # to munge the array to match the get_token() array 13 # After this is called, and before the method returns, you must 14 # use something like the following: 15 # shift @$self if $method == GET_TAG; 16 $tag_func = GET_TAG; 17 if ( '/' ne substr $array_ref->[0], 0, 1 ) { 18 unshift @$array_ref, 'S'; 19 } 20 else { 21 unshift @$array_ref, 'E'; 22 } 23 } 24 return ( $array_ref, $tag_func ); 25 } #### 1 sub as_is { 2 my ( $self, $method ) = _synch_arrays( shift ); 3 my $type = $self->[0]; 4 my $text = $self->[ $token{ $type }{ text } ]; 5 shift @$self if $method == GET_TAG; 6 return $text; 7 }