I use Perltidy to reformat some of my old Perl files in a style that is closer to my current settings. I ran into a problem with this snippet:
Fcntl::S_IRUSR & $mode
Perltidy insists on removing the space after the & token, resulting in:
Fcntl::S_IRUSR &$mode
... which, in my opinion, is a thorn. What can I do to convince Perltidy to leave this single space? I even tried the -fws option -fws no avail.
I am using Perltidy 20101217, which is apparently the latest version.
EDIT:
A few additional observations:
EDIT 2:
I ended up reordering the arguments to the & operator, as this seems to be working on the Perltidy problem currently. In addition, this approach does not require the addition of extra parentheses or any other tokens that could help Perltidy do the โRight Thingโ, but they would certainly confuse me in the end.
UPDATE:
I contacted Steve Hancock, author of Perltidy, on this subject. From his answer:
I checked, and the problem is that in this case, as a sigil function. The main problem is that perltidy does not see prototypes for other modules, even built-in ones, so it should be guessed when it comes to something like "Fcntl :: S_IRUSR". In other words, he does not know if this is a function call or a constant, and he must guess. When you canceled the order, it eliminated the ambiguity on &.
Thanks for the note. I will see if I can come up with a fix to fix this.
source share