[32728] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3992 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 16 14:09:26 2013

Date: Tue, 16 Jul 2013 11:09:03 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 16 Jul 2013     Volume: 11 Number: 3992

Today's topics:
    Re: the fastest way to create a directory (Tim McDaniel)
    Re: the fastest way to create a directory <ben@morrow.me.uk>
    Re: this should work <rweikusat@mssgmbh.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 15 Jul 2013 22:16:55 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: the fastest way to create a directory
Message-Id: <ks1scn$dld$1@reader2.panix.com>

In article <ks1o4c$5jj$1@news.ntua.gr>,
George Mpouras <nospam.gravitalsun.antispam@spamno.hotmail.anispam.com.nospam> wrote:
>yes there are about thousands dirs. try to undestand the code. looks simple 
>but it is not

It *IS* simple.  Microsecond efficiency is highly unlikely to be a
problem for you, so you should, in almost all cases, so with the
reliable solution.

-- 
Tim McDaniel, tmcd@panix.com


------------------------------

Date: Mon, 15 Jul 2013 23:40:20 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: the fastest way to create a directory
Message-Id: <kbaeba-dfc1.ln1@anubis.morrow.me.uk>


Quoth George Mpouras <nospam.gravitalsun.noadsplease@hotmail.noads.com>:
> 
> Create a directory with all upper directories if missing.
> it uses the minimum possible disk access and checks.
> 
> Mkdir_recursive('/some/dir/d1/d2') or die;
> 
> sub Mkdir_recursive
> {
> return 1 if $_[0] eq '' || -d $_[0];
> Mkdir_recursive( $_[0] =~/^(.*?)[\\\/][^\\\/]+$/ ) || return undef;
> mkdir $_[0] || return undef
> }

You'd be better off calling mkdir blind and keying off $! if it fails.
That way you save a stat in the case where the creation succeeds.

Ben



------------------------------

Date: Mon, 15 Jul 2013 23:58:25 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: this should work
Message-Id: <87zjtnfn1q.fsf@sapphire.mobileactivedefense.com>

Ben Morrow <ben@morrow.me.uk> writes:
> Quoth Rainer Weikusat <rweikusat@mssgmbh.com>:
>> Ben Morrow <ben@morrow.me.uk> writes:
>> > Quoth Rainer Weikusat <rweikusat@mssgmbh.com>:
>> >> Ben Morrow <ben@morrow.me.uk> writes:
>> >> > A variable is just a way of giving a value a name;
>> >> 
>> >> This is true for so-called 'functional programming languages' but Perl
>> >> isn't one: There, a 'variable' is something like a deposit box
>> >> (term?): A container which can be used to store 'stuff' of a certain
>> >> kind (depending on the type of box) until it is again needed which can
>> >> be 'addressed' in a convenient way (usually, by using an abstract name
>> >> referring to the 'function' of this variable).
>> >
>> > How is that different from 'just a way of giving a value a name'?
>> 
>> In simply terms, it is 'stuff the value into the named box' vs
>> 'evaluating a term in the context of some binding', that is, with
>> certain set of 'name substitution rules' in place. I don't know if
>> something like 'introductory text books' (or WWW texts) on
>> 'functional programming' (vs 'programming with imperative languages')
>> exist but if they do, you'd find a better explanation there
>> (especially one you're more likely to consider than to reject it 'with
>> a jerk of your knee' because it comes with $authority attached :->).
>
> Yes, I understand the difference between let and setq, and between a pad
> slot called $x and the SV it points to, and I know that Perl has no real
> equivalent of a let-binding.

[JFTR: That would be local]

[...]

>> Arguably for tactical reasons because

[...]

> ESENTENCETOOLONG: Stack overflow, core dumped.

Methinks this should be 'Core overflow, stack dumped' ...

NB: This is not a sensible reply insofar its content goes. But IMO,
everything has been said and fighting the war of the words to the
bitter in end order to remain standing seems tireseom.



------------------------------

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 3992
***************************************


home help back first fref pref prev next nref lref last post