[33094] in Perl-Users-Digest
Perl-Users Digest, Issue: 4370 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 13 09:09:15 2015
Date: Fri, 13 Feb 2015 06:09:02 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 13 Feb 2015 Volume: 11 Number: 4370
Today's topics:
Re: The future of CGI.pm <sbryce@scottbryce.com>
Re: Traversing through sub dirs and read file contents <hjp-usenet3@hjp.at>
Re: Why can I get away with this? <hjp-usenet3@hjp.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 12 Feb 2015 14:34:47 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: The future of CGI.pm
Message-Id: <mbj68k$fiq$1@dont-email.me>
On 2/11/2015 7:21 PM, HASM wrote:
> I must have about 100 cgi.pm scripts running. Hopefully is not going
> to disappear before I have to hand them over :-)
I have closer to 700. I have played with Plack, but did not care for it.
CGI is simpler for what I do. But perhaps it is just a matter of getting
used to Plack.
------------------------------
Date: Thu, 12 Feb 2015 20:25:43 +0100
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: Traversing through sub dirs and read file contents
Message-Id: <slrnmdpvhn.goi.hjp-usenet3@hrunkner.hjp.at>
On 2015-02-11 23:41, Martijn Lievaart <m@rtij.nl.invlalid> wrote:
> On Wed, 11 Feb 2015 21:58:47 +0100, Peter J. Holzer wrote:
>> That depends on what the OP means by "a lot of files". Hundreds?
>> Thousands? Tens of thousands? Millions? Billions? Probably hundreds or
>> thousands. And it probably doesn't matter unless we get into at least
>> the 100k to 1M files per directory range, possibly even higher.
>
> As a side note, current file systems may handle that many files in a
> directory gracefully, but maybe not. Older file systems most definitely
> did not handle such situations well, if at all.
If they don't it matters even less whether you use
my @files = readdir($dh);
for my $filename (@files) {
...
}
or
while (my $filename = readdir($dh)) {
...
}
because the loop will exhibit O(n²) behaviour and the time to read the
directory linearly will be completely swamped for large directories.
> [ I have used disk editors to 'erase' directories on ext2 file systems
> followed by an fsck. That would at least finish in finite time. An rm *
> in the offending directory (or anything else I could think of using
> syscalls) would literally take days. And that was less than 1M files.
It wasn't expanding "*" (the equivalent to readdir) which took days, it
was looking up and removing each file.
hp
--
_ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
|_|_) | | Man feilt solange an seinen Text um, bis
| | | hjp@hjp.at | die Satzbestandteile des Satzes nicht mehr
__/ | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
------------------------------
Date: Thu, 12 Feb 2015 20:18:52 +0100
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: Why can I get away with this?
Message-Id: <slrnmdpv4s.goi.hjp-usenet3@hrunkner.hjp.at>
On 2015-02-11 23:32, Martijn Lievaart <m@rtij.nl.invlalid> wrote:
> On Wed, 11 Feb 2015 21:50:35 +0100, Peter J. Holzer wrote:
>> On 2015-02-10 08:11, Martijn Lievaart <m@rtij.nl.invlalid> wrote:
>>> On Mon, 09 Feb 2015 23:23:41 -0800, Robbie Hatley wrote:
>>>> Wait, there's actually one other character which *MUST* be disallowed
>>>> in file names in nearly every file system, and that's '\0', except
>>>> perhaps as the vary last character of a file name. The reason I say
>>>> that is, if you put '\0' at the beginning or middle of a file name,
>>>> when Perl or the OS tries to read back the file name, it stops reading
>>>> characters when it hits the null terminator, so that THIS file name:
[example deleted]
>>>
>>> I guess you have a C background, because the above is not logical at
>>> all.
>>
>> How is "I observed that \0 terminates a file name, therefore I conclude
>> that \0 cannot be part of a file name" not logical? It may be an
>> overgeneralisation (e.g. there might be an escape mechanism), but the
>> conclusion sounds logical to me.
>
> File names cannot contain nulls. Therefore we can use C strings in the
> API. C strings cannot contain nulls. Therefore file names cannot contain
> nulls.
>
> See anything wrong with that reasoning? :-)
I see two things wrong with it:
1) It's circuitous.
2) It has nothing to do with Robbie's reasoning. You just invented that
out of whole cloth to make him look like an utter idiot[1]. That's a
nasty tactic, however, not very effective on Usenet, where everybody
can go back and read what he really wrote. And even less effective
when you actually quote that. Gee, if you're going to put word's in
anybody's mouth, at least make a token effort to make it convincing.
> Do note that the context here is Windows, so the posix heritage does not
> apply.
Irrelevant since Robbie didn't refer to any "POSIX heritage". He made
an observation (An embedded NUL character terminates a file name) and
drew a conclusion (NUL characters in file names are disallowed).
hp
[1] I'm generally a big fan if Hanlon's razor, but I can't believe your
reading skills are that bad.
--
_ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
|_|_) | | Man feilt solange an seinen Text um, bis
| | | hjp@hjp.at | die Satzbestandteile des Satzes nicht mehr
__/ | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 4370
***************************************