For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > August 2005 > Re: [RFC] File::SplitStream - iterate over files >2GB when large









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [RFC] File::SplitStream - iterate over files >2GB when large
AJ

2005-08-25, 7:59 am

xhoster@gmail.com wrote:
> AJ <ajperl@exiledplanet.org> wrote:
>
>
>
> I don't understand the need for this. It doesn't appear to implement
> "s" and "tell", only streaming. It has been a while since I've used
> a small-file perl, but I never knew there was a problem in streaming large
> files in the first place. I thought it was only s and tell (and
> truncate, and maybe other non-streaming things) which elicited the problem.
>
> Xho
>


I can tell you that s() and tell() are not the only things that don't
work when trying to access a large file without large file support
enabled. In my original case, merely trying to open the file in
question (~20GB size) yielded a "File too large" error immediately.
Rewriting my code to cat the file through a pipe worked until I read
past the 2GB threshold; at that point, the "File too large" error
resurfaced. This system is using an older OS whose perl was not
compiled with large file support enabled and, if given the chance, I
would have upgraded the Perl (and the OS, for that matter). But for
several reasons I am unable to do this. A solution similar to this
module (though not using the same code) seemed to provide the necessary
workaround. My thought was, if I experienced this problem, others might
too. It may be messy, since you're having to carve up a file and double
your required disk space, but it *works*, and in a situation like that,
*working* may be exactly what you need.

I should also point out the module does not *have* to split the original
file up; it can work from a list of files that are already separate for
whatever reason (autorotated log files come to mind). Sure, you can
just cat them, but what if their total size is >2GB? Without large file
support, the perl interpreter will give up after it has read past the
2GB threshold. This module will prevent that from happening. Again,
this is a very specific set of circumstances that ideally one would
avoid. But if you're in such a position, as I was recently, having a
module to give you a helping hand would be a very good thing.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com