On Fri, Dec 17, 1999 at 12:55:12PM +0000, Andrew Ford wrote:
> I have an urgent need for a module to tie an array of integers to an
> mmap'ed file (a sparse array of several hundred million integers). I
> have looked at Mmap.pm by Malcolm Beattie and seen the idea for
> Array::Virtual registered by Larry Wall and have started implementing
> the module I need. But should it be called Array::Virtual (taking
> Larry's slot) or Mmap::Array?
>
> The interface I have in mind is:
>
> use Array::Virtual; # or Mmap::Array
>
> my @array;
> open(FH, "...");
> my $nel = 42;
> my $prot = "rw"; # or "ro", or "wo" or should it be PROT_READ?
> my $shared = 1; # or should it be MAP_SHARED?
> my $offset = 0; # this would be the default anyway
> my $type = "int4" # some set of (string) literals for 1, 2, 4, 8
> # byte integers in native or network byte
> # order, plus floating point (default probably int4)
>
> tie @array, $nel, $prot, $shared, FH, $offset, $type;
>
> $array[0] = 42;
> #etc
>
> undef @array;
>
> Any thoughts?
The word 'Virtual' doesn't carry much meaning here. Maybe:
Tie::MmapArray
I'd switch to using a hash of named parameters to the tie.
I'd also use pack() letters to describe the element type (which would
neatly expand to a string of letters for arrays of structures).
Tim.