Follow

If someone knowledgeable at Perl reads this, can you please tell me why it is that, when installing a module, some *.pm files are executable (555) and others are not (444). What makes the former special? Also, why does Perl use such weird permissions? Thank you in advance.

@josemanuel The execute permission on .pm files is not necessary. However it may be that the installer tool just copies it from the source distribution. Perhaps the original source had it? Sometimes that can happen, especially if Windows or FAT filesystems are involved

@leonerd Thanks a lot! I downloaded the modules from CPAN, and some of those files come with 755 permissions. Then ExtUtils, I believe, chmods them to 555 at install time. It was making me crazy, because I couldn't find any fundamental difference between them and those who got 444 permissions.

@josemanuel If they're just .pm files in the lib/ directory you should be able to `chmod a-x` them all and it'll be fine.

@josemanuel

If they are executable and the she-bang is invalid, then they can't be displayed in a browser. If you're paranoid and don't want others to see your code, this is how to stop them.

@shawnhcorey Thanks a lot for the advice. It's not paranoia (well, maybe there's some of that, too). It's just that they're library files, they don't even have a she-bang, but some of them are executable and others, apparently equal, are not. They caught my attention because Perl files are given such strange permissions on install, and that led me into this rabbit hole of investigating how and why.

What I ended up doing was chmodding 644 all .pm and .pod files and letting ExtUtils do its thing (i.e., turning 644 into 444) during the install process. It seems to have worked fine so far.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.