Module::Build::PM_Filter - Add a PM_Filter feature to Module::Build
This documentation refers to Module::Build::PM_Filter version 1.2
In a Build.PL file you must use this module in place of the Module::Build:
use Module::Build::PM_Filter; my $build = Module::Build::PM_Filter->new( module_name => 'MyIkiWiki::Tools', license => q(gpl), dist_version => '0.2', dist_author => 'Victor Moral <victor@taquiones.net>', ); $build->create_build_script();
In the package directory create a pm_filter file like this:
#!/usr/bin/perl -pl s{##PACKAGE_LIB##}{use lib qw(/usr/share/myprogram);}g;
and change its permissions for user execution.
Then in a script from package insert a line like this:
package MyPackage; use strict; use base; ... ##PACKAGE_LIB## ...
This module provides a Module::Build compatible class and adds a filter for .pm, .pl and script files. The filter could be used to replace Perl source from development environment to production, or to remove debug sentences.
In the debug phase we can play with the application and modules without mattering to us where the library are; when we build the package for distribution, the modules and the scripts will contain the correct path in the final location.
In addition the module makes sure that the archives pm_filter and debian/rules are copied in the distribution directory with the suitable permissions.
This method looks for a file named 'pm_filter' in the current work directory and executes it; his standard input is redirected to the source pm and his standard output is redirected to a temp file.
The temp file is finally installed on the blib/ tree.
This method finds, filters and install the executable files in the package.
This method performs the 'distdir' action and change the permissions of the pm_filter and debian/rules files in the distribution to executable.
croak with this text when it could not run the pm_filter program.
croak with this text when exists a pm_filter file and it not executable.
The location of the pm_filter script must be the current work directory.
There are no known bugs in this module. Please report problems to the author. Patches are welcome.
Victor Moral <victor@taquiones.net>
Copyright (c) 2008 "Victor Moral" <victor@taquiones.net>
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US
To install Module::Build::PM_Filter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::Build::PM_Filter
CPAN shell
perl -MCPAN -e shell install Module::Build::PM_Filter
For more information on module installation, please visit the detailed CPAN module installation guide.