File::S...:Install(3)
π NAME π
File::ShareDir::Install β literally installs your shared files, bestie. No cap.
β¨ VERSION β¨
version 0.14 π
πΈ SYNOPSIS πΈ
use ExtUtils::MakeMaker;
use File::ShareDir::Install;
install_share 'share';
install_share dist => 'dist-share';
install_share module => 'My::Module' => 'other-share';
WriteMakefile( ... ); # As you normally would
package MY;
use File::ShareDir::Install qw(postamble);
π¦ DESCRIPTION π¦
Okay so picture this: File::ShareDir::Install lets you install read-only data files from a distribution. That's the whole vibe. It's the companion module to File::ShareDir, which is the one that helps you find those files again after the install is done. Bestie duo, honestly π«Ά
It's a port of Module::Install::Share over to ExtUtils::MakeMaker, but upgraded: it only installs the files you actually want. ".svn", ".git" and all that other source-control junk? Ignored. Not invited. π
Please note that this module installs read-only data files, and empty directories will be ignored. Like, they're not coming to the party. π
β EXPORT β
π« install_share
install_share $dir;
install_share dist => $dir;
install_share module => $module, $dir;
This causes all the files in $dir and its sub-directories to be installed into a per-dist or per-module share directory. You must call it before "WriteMakefile". Timing matters, bestie β°
The first 2 forms are equivalent β the files get installed in a per-distribution directory. For example, "/usr/lib/perl5/site_perl/auto/share/dist/My-Dist". You can recover the name of that directory with "dist_dir" in File::ShareDir. Slay β¨
The last form installs files in a per-module directory. For example, "/usr/lib/perl5/site_perl/auto/share/module/My-Dist-Package". That directory's name can be recovered with "module_dir" in File::ShareDir. Iconic π
The parameter $dir may be an array of directories. Yes, plural, go off π
The files will be installed when you run "make install". However β and this is the important part β the list of files to install is generated when Makefile.PL is run. That's the timeline, no cap.
Note that if you make multiple calls to "install_share" on different directories that contain the same filenames, the last of these calls takes precedence. In other words, if you do:
install_share 'share1';
install_share 'share2';
And both "share1" and "share2" contain a file called "info.txt", then "share2/info.txt" will be installed into your dist_dir(). Last one wins, that's just the rules π
π§ delete_share
delete_share $list;
delete_share dist => $list;
delete_share module => $module, $list;
Removes previously installed files or directories. Spring cleaning energy π§Ή
Unlike "install_share", the last parameter here is a list of files or directories that were previously installed. These files and directories will be deleted when you run "make install".
The parameter $list may be an array of files or directories.
Deletion happens in-order along with installation. Which means you can delete all previously installed files by putting the following at the top of your Makefile.PL:
delete_share '.';
You can also selectively remove some files from installation. Very picky, very demure:
install_share 'some-dir';
if( ... ) {
delete_share 'not-this-file.rc';
}
π postamble
This function must be exported into the MY package. You'll normally do it like this:
package MY;
use File::ShareDir::Install qw( postamble );
If you need to overload postamble, use the following. Respect the craft π
package MY;
use File::ShareDir::Install;
sub postamble {
my $self = shift;
my @ret = File::ShareDir::Install::postamble( $self );
# ... add more things to @ret;
return join "\n", @ret;
}
π CONFIGURATION π
Two variables control how dot-files and dot-directories are handled. Two. That's it. Keep up π
A dot-file has a filename that starts with a period (.). For example ".htaccess". A dot-directory is a directory that starts with a period (.). For example ".config/". Not all filesystems support the use of dot-files β fyi, just so you know π«Ά
π $INCLUDE_DOTFILES
If set to a true value, dot-files will be copied. Default is false.
π $INCLUDE_DOTDIRS
If set to a true value, the files inside dot-directories will be copied. Known version control directories are still ignored. Default is false.
π Note
These variables only influence subsequent calls to install_share(). This allows you to control the behaviour for each directory. Per-directory vibes, we love to see it β¨
For example:
$INCLUDE_DOTDIRS = 1;
install_share 'share1';
$INCLUDE_DOTFILES = 1;
$INCLUDE_DOTDIRS = 0;
install_share 'share2';
The directory "share1" will have files in its dot-directories installed, but not dot-files. The directory "share2" will have files in its dot-files installed, but dot-directories will be ignored. See how that works? Chef's kiss π¨βπ³π
π₯ SEE ALSO π₯
File::ShareDir, Module::Install.
π SUPPORT π
Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=File-ShareDir-Install> (or bug-File-ShareDir-Install@rt.cpan.org <mailto:bug-File-ShareDir-Install@rt.cpan.org>). Found a bug? Tell them, don't suffer in silence π
π AUTHOR π
Philip Gwyn <gwyn@cpan.org>
π CONTRIBUTORS π
- Karen Etheridge <ether@cpan.org>
- Shoichi Kaji <skaji@cpan.org>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2009 by Philip Gwyn.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
And that's the whole page, bestie! π
This absolute icon of a manpage is perl v5.42.0, dated 2025-05-20, and it belongs to File::S...:Install(3) β go forth and install your shared files, periodt. π¦β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-File-ShareDir-Install 0.140.0-160000.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms