How can I configure Module :: Build to NOT install files as read-only?

I came across a script when I create a Perl module as part of another build system on a Windows machine. I use the --install_base parameter of the :: Build module to specify a temporary directory to place the module files until the general assembly system can use them. Unfortunately, this other build system has problems if any of its files, on which it depends, are read only - it tries to delete all generated files before restoring them and cannot clear read-only files (it tries to delete them , and this is just a read that gives an error.) By default, Module::Build installs its libraries with the read-only bit turned on.

One option is to take a new step in the build process, which removes the read-only bit from the installed files, but because of the nature of the build tool, which will require a second temporary directory ... ugh.

Is it possible to configure the installer based on Module::Build to NOT enable this read-only bit when files are installed in the --install_base directory? If so, how?

+4
source share
1 answer

No, this is not a custom parameter. This is done in the copy_if_modified method in Module::Build::Base :

 # mode is read-only + (executable if source is executable) my $mode = oct(444) | ( $self->is_executable($file) ? oct(111) : 0 ); chmod( $mode, $to_path ); 

If you control Build.PL, you can subclass Module::Build and override copy_if_modified to call the base class, and then the writable chmod file. But I get the impression that you're just trying to install another module.

Probably the easiest way would be to install a copy of Module::Build in a private directory and then edit it to use oct(666) (or any other mode). Then call perl -I /path/to/customized/Module/Build Build.PL . Or, as you said, just use the standard Module::Build and add a separate step to mark everything that can be written later.

Update: ysth is correct; he is ExtUtils :: Install , which actually makes the final copy. copy_if_modified is for populating blib . But ExtUtils :: Install also hardcodes read-only mode. You can use the individual version of ExtUtils :: Install, but it's probably easier to just take a separate step.

+4
source

All Articles