in reply to Re**5: Compressed content module
in thread Compressed content module

And I thought you'd just suggesting running file(1) on the file. So between a call to file(1) and just reading the first two bytes which are going to be read anyway... I don't see how that's particularly expensive. But then all this only applies if you want to detect GZip/compress files which don't use a .gz/.Z extension.

__SIG__ use B; printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B::svref_2object(sub{})->OUTSIDE;

Replies are listed 'Best First'.
Re**7: Compressed content module
by belg4mit (Prior) on Dec 01, 2002 at 23:35 UTC
    First off it's all moot, this thread started from my misreading the code and thinking he was checking to see if the filename ended in .gz. Secondly, no I did not suggest using file, I said do something like file. Thirdly, while the file will be being read (and so doing the test may preload it into the cache), the bytes read will have to be discarded making that read otherwise worthless. But again, it's all irrelevant. We now return you to youre regularly scheduled NodeReaper-watching.;

    --
    I'm not belgian but I play one on TV.