View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Víctor Moral > Module-Build-PM_Filter-v1.21 > Module::Build::PM_Filter



Annotate this POD

View/Report Bugs
Module Version: v1.21   Source  


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 <>',


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;





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.


process_pm_files( )

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.

process_script_files( )

This method finds, filters and install the executable files in the package.

ACTION_distdir( )

This method performs the 'distdir' action and change the permissions of the pm_filter and debian/rules files in the distribution to executable.


pm_filter failed ...

croak with this text when it could not run the pm_filter program.

pm_filter not executable ...

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 <>


Copyright (c) 2008 "Victor Moral" <>

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

syntax highlighting: