Skip Menu |

This queue is for tickets about the DBM-Deep CPAN distribution.

Report information
The Basics
Id: 85414
Status: resolved
Priority: 0/
Queue: DBM-Deep

People
Owner: Nobody in particular
Requestors: james [...] incoherency.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: DBM::Deep::Array::PUSH doesn't use "defined"
Date: Sat, 18 May 2013 14:36:10 +0100
To: bug-DBM-Deep [...] rt.cpan.org
From: James Stanley <james [...] incoherency.co.uk>
DBM::Deep::Array has: sub PUSH { ## # Add new element(s) to the end of the array ## my $self = shift->_get_self; $self->lock( $self->LOCK_EX ); my $length = $self->FETCHSIZE(); while (my $content = shift @_) { $self->STORE( $length, $content ); $length++; } $self->unlock; return $length; } the while loop test should be while (defined (my $content = shift @_)) { otherwise it is impossible to push 0's or empty strings to an array. Regards, James Stanley
I've replied to the pull request at https://github.com/robkinyon/dbm-deep/pull/1 On Sat May 18 09:36:32 2013, james@incoherency.co.uk wrote: Show quoted text
> DBM::Deep::Array has: > > sub PUSH { > ## > # Add new element(s) to the end of the array > ## > my $self = shift->_get_self; > > $self->lock( $self->LOCK_EX ); > > my $length = $self->FETCHSIZE(); > > while (my $content = shift @_) { > $self->STORE( $length, $content ); > $length++; > } > > $self->unlock; > > return $length; > } > > the while loop test should be > while (defined (my $content = shift @_)) { > otherwise it is impossible to push 0's or empty strings to an array. > > Regards, > > James Stanley