The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Module::Build::PM_Filter - Add a PM_Filter feature to Module::Build

SYNOPSIS

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

    ...

DESCRIPTION

This module provides a Module::Build compatible class and adds a filter for pm files. The filter could be used to replace Perl source from development environment to production.

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.

SUBRUTINES/METHODS

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 make the pm_filter file in the distribution directory is executable.

DIAGNOSTICS

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.

DEPENDENCIES

Module::Build

BUGS AND LIMITATIONS

There are no known bugs in this module. Please report problems to the author. Patches are welcome.

AUTHOR

Victor Moral <victor@taquiones.net>

LICENCE AND COPYRIGHT

Copyright (c) 2005 "Víctor 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

1 POD Error

The following errors were encountered while parsing the POD:

Around line 237:

Non-ASCII character seen before =encoding in '"Víctor'. Assuming CP1252