in reply to Automatic type conversion in a sub parameter causing a problem

Welcome to the Monastery, davebock!

I can get it to work after making a couple of slight changes (moving the oct() call to inside of the call to make_path(), and fixing your compile-time errors). First, replace:

my $usedMode = oct($Mode);

with:

my $usedMode = $mode;

then, replace:

make_path( $dirPathName, { mode => $usedMode, error => \$err ) );

with:

make_path( $dirPathName, { mode => oct($usedMode), error => \$err +} );

Note that you don't need the intermediary $usedMode variable... it can be refactored out, and you can simply use $mode instead.

-stevieb

Replies are listed 'Best First'.
Re^2: Automatic type conversion in a sub parameter causing a problem
by davebock (Initiate) on Oct 22, 2015 at 17:40 UTC

    It still does not work for me. The existence of the extraneous variables is because I have been experimenting with moving the oct() around and add things like $mode . " " or $mode + 0 to see if I can affect the value. I am starting to suspect that I have an old, and buggy, module somewhere. I am unable to update my modules at all, short of hand typing them myself and putting them locally. My File::Path module is version 5.005_04

      Could you try the builtin mkdir instead as a test? Although you're setting permissions as you create, chmod might be worth a look too.

        Yes, I did try mkdir at the first iteration. Same problem. The issue seems to be that the value being passed into the sub "looks" different inside the sub depending on how the sub was called. Please see the sample calls and output.

        Mistake: My real File::Path module is version '2.08'.