Subject: Re: [X2Go-Dev] Bug#715: Proposed patch

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:
> Hi Michael,
>
>
> On  Mo 05 Jan 2015 05:12:04 CET, Michael DePaulo wrote:
>
>> 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
>
>
> 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
[...]

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