Skip Menu |

This queue is for tickets about the File-Map CPAN distribution.

Report information
The Basics
Id: 63100
Status: resolved
Priority: 0/
Queue: File-Map

People
Owner: LEONT [...] cpan.org
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: not mapping non-binary handle
Date: Thu, 18 Nov 2010 12:07:47 +1100
To: bug-File-Map [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
In File::Map 0.30 is it only a warning to map a handle with an encoding layer? In my locate iterator thingie I try to choose between mmap and plain i/o according to whether I'll see the same from an mmap as from read(). I liked it better as an error attempting to mmap a non-binary handle. I'd like to have either an option for an error, or alternately expose the _check_layers() func so that I can enquire as to how the layers look from an mmap perspective. The name check_layers() might instead be something about "mmap clean" or "transforming layers" or "rawness" but in any case could say if I ought to see the same from mmap as from read(), as far as the perlio layers go at least. -- The most important thing when choosing fish is freshness. Whenever I buy seafood extender I make sure it was thawed no more than 2 hours ago.
Hi Kevin, Show quoted text
> I liked it better as an error attempting to mmap a non-binary handle.
I'd like to have either an option for an error, or alternately expose the _check_layers() func so that I can enquire as to how the layers look from an mmap perspective. Right now I don't want to make it an error just yet, if only because it would break people's code. The layers-checking is currently not checking crlf translation and when it gets stricter it will affect current users on Windows. I am open to making it an error at some point in the future though. My solution to the crlf problem is PerlIO::Layers, but so far it is not passing its tests on Windows and I haven't had the time to look more deeply into it: the problem may be a bug in perl, not in PIO::L. It's on my todo list, but that list is fairly long. So the solution in the near future (when File::Map will be using PIO::L) is to use PIO::L yourself to check if it is mapable. TL;DR: we're in an in between state, things will get better when File::Map is through all of that. Leon
Subject: Re: [rt.cpan.org #63100] not mapping non-binary handle
Date: Sat, 11 Dec 2010 10:09:03 +1100
To: bug-File-Map [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
"Leon Timmermans via RT" <bug-File-Map@rt.cpan.org> writes: Show quoted text
> > Right now I don't want to make it an error just yet, if only because it > would break people's code.
Actually, it slightly breaks mine not to have an error. My code worked on the basis that if mmap succeeds then I see in the variable what I would see from a read. It's saved by my docs saying binary mode for normal use, so sensible users (if there are any users :-) may not be bitten ... Show quoted text
> I am open to making it an error at some point in the future though.
Well, an error, or a way to query, or both. I removed the layers bits from my code when you took it in. (I think what I've got for "use mmap if possible, use read otherwise" is a fairly likely approach, since for maximum portability you can't demand mmap, so have the read code, then later add some faster mmap code and choose between at runtime.) Show quoted text
> My solution to the crlf problem is PerlIO::Layers, but so far it is not > passing its tests on Windows
That's the bit I never followed. I imagine the info is in there somewhere.
On Fri Dec 10 18:09:17 2010, user42@zip.com.au wrote: Show quoted text
> That's the bit I never followed. I imagine the info is in there > somewhere.
You can use this: use PerlIO::Layers qw/query_handle/; if (query_handle($fh, 'mappable')) { # Map it } else { # Read it }
Subject: Re: [rt.cpan.org #63100] not mapping non-binary handle
Date: Wed, 02 Feb 2011 11:49:09 +1100
To: bug-File-Map [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
"Leon Timmermans via RT" <bug-File-Map@rt.cpan.org> writes: Show quoted text
> > use PerlIO::Layers qw/query_handle/; > if (query_handle($fh, 'mappable')) {
Are you sure? There's no absolute notion of the layers being mappable is there? It's a matter of what File::Map at present will do. In which case you'd probably prefer a func or error option etc in File::Map than having one module try to describe the capabilities of another.