File::ShareDir::Install - Install shared files
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 normaly would package MY; use File::ShareDir::Install qw(postamble);
File::ShareDir::Install allows you to install read-only data files from a distribution. It is a companion module to File::ShareDir, which allows you to locate these files after installation.
It is a port of Module::Install::Share to ExtUtils::MakeMaker with the improvement of only installing the files you want; .svn and other source-control junk will be ignored.
.svn
install_share $dir; install_share dist => $dir; install_share module => $module, $dir;
Causes all the files in $dir and its sub-directories to be installed into a per-dist or per-module share directory. Must be called before WriteMakefile.
$dir
The first 2 forms are equivalent.
The files will be installed when you run make install.
make install
To locate the files after installation so they can be used inside your module, see File::ShareDir.
my $dir = File::ShareDir::module_dir( $module );
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
install_share 'share1'; install_share 'share2';
And both share1 and share2 contain a fill called info, the file share2/info will be installed into your dist_dir().
share1
share2
info
share2/info
dist_dir()
Exported into the MY package. Only documented here if you need to write your own postamble.
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; }
File::ShareDir, Module::Install.
Philip Gwyn, <gwyn-AT-cpan.org>
Copyright (C) 2009-2011 by Philip Gwyn
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install File::ShareDir::Install, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::ShareDir::Install
CPAN shell
perl -MCPAN -e shell install File::ShareDir::Install
For more information on module installation, please visit the detailed CPAN module installation guide.