Subject: | EXTEND changes visible size of file and array. |
Bug present in at least Tie::File 0.97 and 0.97_02.
EXTEND is used to expand the internal buffer.
STORESIZE is used to actually change the visible size of the array.
Tie::File incorrectly treats EXTEND as STORESIZE.
When sorting in place (@a = sort @a) on a magical array (such as one
tied to Tie::File), sort EXTENDs the array to scalar(@a)+1 elements.
This is meant to extend the internal storage size, but it has visible
effects when the array is tied to Tie::File. The reported number of
elements is different than it should be, and a blank line is appended to
the file (in the sort example).
See http://www.perlmonks.org/?node_id=710580 for runnable code and some
extra details.