summaryrefslogtreecommitdiff
path: root/pod/perltie.pod
diff options
context:
space:
mode:
authorCasey R. Tweten <crt@kiski.net>2000-11-28 07:11:41 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2000-11-29 02:07:24 +0000
commitf9abed49f951c841c50978ddb2167961d3dab523 (patch)
tree31d54ca289028e9c60f2359df9551ef457f79481 /pod/perltie.pod
parent5865a7df1443ffc1b82a03eb4d08f0a8a7fe3fff (diff)
downloadperl-f9abed49f951c841c50978ddb2167961d3dab523.tar.gz
Re: [PATCH] Updating perltie.pod for arrays
Date: Tue, 28 Nov 2000 12:11:41 -0500 (EST) Message-ID: <Pine.OSF.4.21.0011281209050.25178-100000@home.kiski.net> Subject: Re: [PATCH] Updating perltie.pod for arrays From: "Casey R. Tweten" <crt@kiski.net> Date: Tue, 28 Nov 2000 15:03:50 -0500 (EST) Message-ID: <Pine.OSF.4.21.0011281458500.10331-100000@home.kiski.net> p4raw-id: //depot/perl@7907
Diffstat (limited to 'pod/perltie.pod')
-rw-r--r--pod/perltie.pod26
1 files changed, 16 insertions, 10 deletions
diff --git a/pod/perltie.pod b/pod/perltie.pod
index 8b3f6799a9..1f77f55660 100644
--- a/pod/perltie.pod
+++ b/pod/perltie.pod
@@ -311,15 +311,19 @@ deleted.
In our example, 'undef' is really an element containing
C<$self-E<gt>{ELEMSIZE}> number of spaces. Observe:
-sub STORESIZE {
- my $self = shift;
- my $count = shift;
- if ( $count > $self->FETCHSIZE() ) {
- $self->STORE( $_, '' ) foreach $count - $self->FETCHSIZE() + 1 .. $count;
- } elsif ( $count < $self->FETCHSIZE() ) {
- $self->POP() foreach 0 .. $self->FETCHSIZE() - $count + 1;
- }
-}
+ sub STORESIZE {
+ my $self = shift;
+ my $count = shift;
+ if ( $count > $self->FETCHSIZE() ) {
+ foreach ( $count - $self->FETCHSIZE() .. $count ) {
+ $self->STORE( $_, '' );
+ }
+ } elsif ( $count < $self->FETCHSIZE() ) {
+ foreach ( 0 .. $self->FETCHSIZE() - $count - 2 ) {
+ $self->POP();
+ }
+ }
+ }
=item EXTEND this, count
@@ -346,7 +350,9 @@ C<$self-E<gt>{ELEMSIZE}> spaces only, it does not exist:
sub EXISTS {
my $self = shift;
my $index = shift;
- return $self->{ARRAY}->[$index] eq ' ' x $self->{ELEMSIZE} ? 0 : 1;
+ return 0 if ! defined $self->{ARRAY}->[$index] ||
+ $self->{ARRAY}->[$index] eq ' ' x $self->{ELEMSIZE};
+ return 1;
}
=item DELETE this, key