On Thu, Mar 01, 2012 at 10:13:15AM -0800, Karl Williamson via RT wrote:
> I can't find my proposal in the record of this ticket, nor anyone
> responding to it.  The documentation says that $/ gives the *maximum*
> record size.  So why not return as many whole characters as will fit in
> $/ bytes?

Specifically, the code is emulated on "everything else", but intended to
do something real and useful on VMS:

#ifdef VMS
    /* VMS wants read instead of fread, because fread doesn't respect */
    /* RMS record boundaries. This is not necessarily a good thing to be */
    /* doing, but we've got no other real choice - except avoid stdio
       as implementation - perhaps write a :vms layer ?
    */
    fd = PerlIO_fileno(fp);
    if (fd != -1) {
        bytesread = PerlLIO_read(fd, buffer, recsize);
    }
    else /* in-memory file from PerlIO::Scalar */
#endif

perlvar.pod says:

    On VMS, record reads are done with the equivalent of C<sysread>,
    so it's best not to mix record and non-record reads on the same
    file.  (This is unlikely to be a problem, because any file you'd
    want to read in record mode is probably unusable in line mode.)
    Non-VMS systems do normal I/O, so it's safe to mix record and
    non-record reads of a file.

> I think we need to do something on this for 5.16.  At the minimum, we
> could emit a warning when a variable length encoded file is opened under
> a fixed-length $/.
> 
> If even that isn't acceptable, we could add this to the
> intend-to-deprecate section in perldelta.

So I'd like to know, if a programmer on VMS sets $/ to read records, but on
a file handle marked with :utf8, what do they want?

(and if the answer is "their head examining", that's actually useful, as it
means that the least insane thing to implement is what we get)

Nicholas Clark

Reply via email to