On Feb 7, 2008 8:01 AM, Hein, Nashua NH <[EMAIL PROTECTED]> wrote: > > And I should probably try the raw C-RTL fgetpos/fsetpos also > > Tried that. The underlying c-rtl function works fine for large files. > See topic in perl.vmsperl. > > John Malberg commented there that this might have something to do with > compiling with LARGEFILES or not. That may be the case for tell/seek, > and fstat, but IMHO the setpos/getpos is specifically there to avoid > even thinking about 64-bitnes. It just uses an opaque storage unit. > And furthermore the formula used to transform the system position (RMS > RFA) to the exposed variable is broken for indexed files. Multiple > unique addresses can cold into the same cookie.
For reasons I don't understand, Perl determines whether fgetpos and fsetpos are available, but then in the default case disables what it has discovered and uses home-made versions instead. The home-made versions are based on tell and seek, which depend on the size of off_t. You can see this by searching for "PerlIO_getpos" here: http://public.activestate.com/cgi-bin/perlbrowse/b/perlio.c On VMS (and probably other platforms), when _LARGEFILE is not defined at compile time, off_t is 32 bits, but 64 bits when _LARGEFILE is defined. So configuring with -Duselargefiles is going to be the only way to get Perl's fgetpos/fsetpos to have any hope of working on large files. Which is a pity, since, as Hein points out, nothing outside the C run-time implementation should know or care what's in the struct that fgetpos and fsetpos share only with each other. I have a feeling PerlIO intentionally broke the fgetpos/fsetpos API in order to make the file positions compatible with tell/seek. If anything important depends on that, there may not be much that can be done about it. If that was just a convenience and not important, the following may be all that's needed to restore the real fgetpos/fsetpos: --- perlio.c;-0 Wed Nov 7 06:14:06 2007 +++ perlio.c Thu Feb 7 11:16:10 2008 @@ -5139,9 +5139,6 @@ PerlIO_tmpfile(void) return f; } -#undef HAS_FSETPOS -#undef HAS_FGETPOS - #endif /* USE_SFIO */ #endif /* PERLIO_IS_STDIO */ [end]