Subject: Bug#715: Proposed patch

From: Michael DePaulo <[email-masked]>
Date: Sun, 4 Jan 2015 23:12:04 -0500

Tags: patch

I would like someone who knows Perl better, such as theUser2, to
review this patch.

Although this is a very small patch, theUser2 advised me to be careful
when creating full paths.

I tested it successfully under CentOS 5 and CentOS 6.

I intended to use "make_path" instead of "mkpath" if File::Path 2.06
or later was detected. However, I could not figure out how to write a
statement like "use File::Path( make_path)" if File::Path->VERSION is
2.06 or later. Specifically, it appears that "use" statements are
executed at compile time in Perl, so they cannot be used within an if
block. And I cannot just specify "use File::Path" for all versions of
File::Path because "make_path" is not exported by default.

EPEL 5:
http://perldoc.perl.org/5.8.8/File/Path.html

EPEL 6:
http://perldoc.perl.org/5.10.1/File/Path.html

Latest:
http://perldoc.perl.org/File/Path.html

---

From: Mike Gabriel <[email-masked]>
Date: Mon, 05 Jan 2015 10:13:34 +0000

Hi Michael,

> http://perldoc.perl.org/File/Path.html

I recommend a more conditional approach testing the existence of the  
make_path (and the mkpath) function during runtimed using the  
"defined" command.

See:  
http://stackoverflow.com/questions/433752/how-can-i-determine-if-a-perl-function-exists-at-runtime

Mike

-- 

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
fon: +49 (1520) 1976 148

GnuPG Key ID 0x25771B31
mail: [email-masked], http://das-netzwerkteam.de

freeBusy:
https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xfb

---

From: Michael DePaulo <[email-masked]>
Date: Mon, 5 Jan 2015 08:29:18 -0500

Hi Mike#1,

On Mon, Jan 5, 2015 at 5:13 AM, Mike Gabriel
<[email-masked]> wrote:
> make_path (and the mkpath) function during runtimed using the "defined"
> command.
>
> See:
[...]

I will follow that advice for runtime, but I still need to figure out
what to do at compile time.

http://perldoc.perl.org/functions/use.html
"Because use takes effect at compile time, it doesn't respect the
ordinary flow control of the code being compiled. In particular,
putting a use inside the false branch of a conditional doesn't prevent
it from being processed."

-Mike#2

---

From: Mike Gabriel <[email-masked]>
Date: Mon, 05 Jan 2015 15:22:42 +0000

Hi Michael,

> it from being processed."

Ah, ok.

Simply import (use) the complete File::Path package (use File::Path)  
and reference the make_path and the mkpath function under its full  
package+function name (i.e. "File::Path::make_path", e.g.).

Mike

-- 

DAS-NETZWERKTEAM

GnuPG Key ID 0x25771B31

freeBusy: