Array::Virtual

Provides disk based arrays implemented via tied hashes
Download

Array::Virtual Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Philip Crow
  • Publisher web site:
  • http://search.cpan.org/~philcrow/

Array::Virtual Tags


Array::Virtual Description

Provides disk based arrays implemented via tied hashes Array::Virtual is a Perl module that allows a user to tie an array to a disk file. The actual storage scheme is a hash tied via SDBM_File.The module optimizes push, pop, shift, and unshift for speed. For SPLICE, it uses the method inherited from Tie::Array. Splicing requires moving elements around. Since there is really no short cut for that, there is not a real way to optimize this routine, thus it is borrowed. Genuine DELETE is not yet supported. Attempting to call DELETE will result in the inherited croak from Tie::Array.Once you issue a line like tie @myarray, "Virtual", "diskname", 0664; you may use @myarray just as you would any other array. The array will be stored in a pair of files called diskname.array.dir and diskname.array.pag. Any path is preserved through the call, but .array.... is always appended. (This module puts on the array extension, SDBM_File puts on the other extensions.)If the disk files for the array already exists, the array is opened and its contents are the same as the last time the disk array was used. If you want to purge the disk array, simply unlink its files either inside or outside of perl. Say something like unlink \< diskname.array.*\ >.If the files cannot be found, they are created with the given permissions if supplied (or with 0666 modified by your umask by default).SYNOPSIS use Array::Virtual; tie @myarray, "Array::Virtual", "diskname", 0664; push @myarray, "value"; my $stackpop = pop @myarray; unshift @myarray, "value1"; my $queuefront = shift @myarray; . . . etc. Requirements: · Perl


Array::Virtual Related Software