dev > perl > modules > documentation
document updated 11 years ago, on Jun 7, 2011

Using Filter::Simple without any extra packages


    use strict;
    use warnings;

    use Filter::Simple;
    BEGIN { Filter::Simple::gen_filter_import(__PACKAGE__, sub {
                s/BANG\s+BANG/die 'BANG' if \$BANG/g;
    })->(); }

our $BANG = 1;


Filtering ALL modules

Source filters normally have to be manually loaded into each module, on a case-by-case basis. How do you automatically shove it into every module?

Two tricks needed for this:

This can have very wide-ranging effects. It's even more dangerous than normal source filters. That said...

Other examples of CPAN modules that do this includes: Acme::use::strict::with::pride, PAR::PAR