> At 02:19 PM 2/14/00 -0800, Brad Hughes wrote:
        >>2) Dan's (the other one) suggestion of VMS::IndexedFile may work
except that
        >>    I've found that embedded "\n" in text fields tend to cause
truncation.
        >
        >I bet that's a problem with fwrite thinking \n is a record
separator. It's 
        >amazing how much I hate the compromises C forces some days...
        >
        >This can probably be fixed easily enough with appropriate abuse to 
        >IndexedFile.XS...
        >
        >                                       Dan
Dan,
IndexedFile.XS is full of calls to sys$get, put etc - no sign of a call to
fwrite so I'm not
sure what you are refering to here. 
FWIW I just created a test indexed file using create/fdl and then ran the
following simple
script and it worked fine ( key is 0-9, char, variable length rec, max
record len 1000 ).
One gotcha - the file must have a max record length - since this is used to
malloc the
buffer for the read records.
use VMS::IndexedFile;

my $obj = tie( %file, VMS::IndexedFile, "testfile.dat" ) or die "Cant open
file $!";

for ( $i=100; $i< 200; $i++ ) {
  $rec = sprintf( "%010dRecord number %d\nOther stuff\nAnd more", $i, $i );
  $file{ substr($rec,0,10) } = $rec;
}

foreach ( values %file ) {
  print $_, "\n";
}

Reply via email to