™.. Filter::Simple - Online Linux Manual PageSection : 3pm
Updated : 2009-04-11
Source : perl v5.10.1
Note : Perl Programmers Reference Guide
NAMEFilter::Simple − Simplified source filtering
SYNOPSIS # in MyFilter.pm:
package MyFilter;
use Filter::Simple;
FILTER { ... };
# or just:
#
# use Filter::Simple sub { ... };
# in user's code:
use MyFilter;
# this code is filtered
no MyFilter;
# this code is not
DESCRIPTION
The ProblemSource filtering is an immensely powerful feature of recent versions of Perl. It allows one to extend the language itself (e.g. the Switch module), to simplify the language (e.g. Language::Pythonesque), or to completely recast the language (e.g. Lingua::Romana::Perligata). Effectively, it allows one to use the full power of Perl as its own, recursively applied, macro language. The excellent Filter::Util::Call module (by Paul Marquess) provides a usable Perl interface to source filtering, but it is often too powerful and not nearly as simple as it could be. To use the module it is necessary to do the following: 1. Download, build, and install the Filter::Util::Call module. (If you have Perl 5.7.1 or later, this is already done for you.) 2. Set up a module that does a \*(C`use Filter::Util::Call\*(C'\fR. 3. Within that module, create an \*(C`import\*(C'\fR subroutine. 4. Within the \*(C`import\*(C'\fR subroutine do a call to \f(CW\*(C`filter_add\*(C'\fR, passing it either a subroutine reference. 5. Within the subroutine reference, call \*(C`filter_read\*(C'\fR or \f(CW\*(C`filter_read_exact\*(C'\fR to ‟prime” $_ with source code data from the source file that will \*(C`use\*(C'\fR your module. Check the status value returned to see if any source code was actually read in. 6. Process the contents of $_ to change the source code in the desired manner. 7. Return the status value. 8. If the act of unimporting your module (via a \*(C`no\*(C'\fR) should cause source code filtering to cease, create an \*(C`unimport\*(C'\fR subroutine, and have it call \*(C`filter_del\*(C'\fR. Make sure that the call to \f(CW\*(C`filter_read\*(C'\fR or \*(C`filter_read_exact\*(C'\fR in step 5 will not accidentally read past the \*(C`no\*(C'\fR. Effectively this limits source code filters to line-by-line operation, unless the \*(C`import\*(C'\fR subroutine does some fancy pre-pre-parsing of the source code it's filtering. For example, here is a minimal source code filter in a module named BANG.pm. It simply converts every occurrence of the sequence \*(C`BANG\es+BANG\*(C'\fR to the sequence \*(C`die \*(AqBANG\*(Aq if $BANG\*(C'\fR in any piece of code following a \*(C`use BANG;\*(C'\fR statement (until the next \f(CW\*(C`no BANG;\*(C'\fR statement, if any): package BANG;
use Filter::Util::Call ;
sub import {
filter_add( sub {
my $caller = caller;
my ($status, $no_seen, $data);
while ($status = filter_read()) {
if (/^\s*no\s+$caller\s*;\s*?$/) {
$no_seen=1;
last;
}
$data .= $_;
$_ = "";
}
$_ = $data;
s/BANG\s+BANG/die 'BANG' if \$BANG/g
unless $status < 0;
$_ .= "no $class;\n" if $no_seen;
return 1;
})
}
sub unimport {
filter_del();
}
1 ;
This level of sophistication puts filtering out of the reach of many programmers.
A SolutionThe Filter::Simple module provides a simplified interface to Filter::Util::Call; one that is sufficient for most common cases. Instead of the above process, with Filter::Simple the task of setting up a source code filter is reduced to: 1. Download and install the Filter::Simple module. (If you have Perl 5.7.1 or later, this is already done for you.) 2. Set up a module that does a \*(C`use Filter::Simple\*(C'\fR and then calls \*(C`FILTER { ... }\*(C'\fR. 3. Within the anonymous subroutine or block that is passed to \*(C`FILTER\*(C'\fR, process the contents of \f(CW$_\fR to change the source code in the desired manner. In other words, the previous example, would become: package BANG;
use Filter::Simple;
FILTER {
s/BANG\s+BANG/die 'BANG' if \$BANG/g;
};
1 ;
Note that the source code is passed as a single string, so any regex that uses \*(C`^\*(C'\fR or \f(CW\*(C`$\*(C'\fR to detect line boundaries will need the \f(CW\*(C`/m\*(C'\fR flag.
Disabling or changing <no> behaviourBy default, the installed filter only filters up to a line consisting of one of the three standard source ‟terminators”: no ModuleName; # optional comment
or: _ _END_ _
or: _ _DATA_ _
but this can be altered by passing a second argument to \*(C`use Filter::Simple\*(C'\fR or \*(C`FILTER\*(C'\fR (just remember: there's \fIno\fR comma after the initial block when you use \*(C`FILTER\*(C'\fR). That second argument may be either a \*(C`qr\*(C'\fR'd regular expression (which is then used to match the terminator line), or a defined false value (which indicates that no terminator line should be looked for), or a reference to a hash (in which case the terminator is the value associated with the key 'terminator'. For example, to cause the previous filter to filter only up to a line of the form: GNAB esu;
you would write: package BANG;
use Filter::Simple;
FILTER {
s/BANG\s+BANG/die 'BANG' if \$BANG/g;
}
qr/^\s*GNAB\s+esu\s*;\s*?$/;
or: FILTER {
s/BANG\s+BANG/die 'BANG' if \$BANG/g;
}
{ terminator => qr/^\s*GNAB\s+esu\s*;\s*?$/ };
and to prevent the filter's being turned off in any way: package BANG;
use Filter::Simple;
FILTER {
s/BANG\s+BANG/die 'BANG' if \$BANG/g;
}
""; # or: 0
or: FILTER {
s/BANG\s+BANG/die 'BANG' if \$BANG/g;
}
{ terminator => "" };
Note that, no matter what you set the terminator pattern to, the actual terminator itself must be contained on a single source line.
All-in-one interfaceSeparating the loading of Filter::Simple: use Filter::Simple;
from the setting up of the filtering: FILTER { ... };
is useful because it allows other code (typically parser support code or caching variables) to be defined before the filter is invoked. However, there is often no need for such a separation. In those cases, it is easier to just append the filtering subroutine and any terminator specification directly to the \*(C`use\*(C'\fR statement that loads Filter::Simple, like so: use Filter::Simple sub {
s/BANG\s+BANG/die 'BANG' if \$BANG/g;
};
This is exactly the same as: use Filter::Simple;
BEGIN {
Filter::Simple::FILTER {
s/BANG\s+BANG/die 'BANG' if \$BANG/g;
};
}
except that the \*(C`FILTER\*(C'\fR subroutine is not exported by Filter::Simple.
Filtering only specific components of source codeOne of the problems with a filter like: use Filter::Simple;
FILTER { s/BANG\s+BANG/die 'BANG' if \$BANG/g };
is that it indiscriminately applies the specified transformation to the entire text of your source program. So something like: warn 'BANG BANG, YOU'RE DEAD';
BANG BANG;
will become: warn 'die 'BANG' if $BANG, YOU'RE DEAD';
die 'BANG' if $BANG;
It is very common when filtering source to only want to apply the filter to the non-character-string parts of the code, or alternatively to only the character strings. Filter::Simple supports this type of filtering by automatically exporting the \*(C`FILTER_ONLY\*(C'\fR subroutine. \*(C`FILTER_ONLY\*(C'\fR takes a sequence of specifiers that install separate (and possibly multiple) filters that act on only parts of the source code. For example: use Filter::Simple;
FILTER_ONLY
code => sub { s/BANG\s+BANG/die 'BANG' if \$BANG/g },
quotelike => sub { s/BANG\s+BANG/CHITTY CHITTY/g };
The "code" subroutine will only be used to filter parts of the source code that are not quotelikes, POD, or \*(C`_\|_DATA_\|_\*(C'\fR. The \f(CW\*(C`quotelike\*(C'\fR subroutine only filters Perl quotelikes (including here documents). The full list of alternatives is: ``code'' Filters only those sections of the source code that are not quotelikes, POD, or \*(C`_\|_DATA_\|_\*(C'\fR. ``code_no_comments'' Filters only those sections of the source code that are not quotelikes, POD, comments, or \*(C`_\|_DATA_\|_\*(C'\fR. ``executable'' Filters only those sections of the source code that are not POD or \*(C`_\|_DATA_\|_\*(C'\fR. ``executable_no_comments'' Filters only those sections of the source code that are not POD, comments, or \*(C`_\|_DATA_\|_\*(C'\fR. ``quotelike'' Filters only Perl quotelikes (as interpreted by &Text::Balanced::extract_quotelike). ``string'' Filters only the string literal parts of a Perl quotelike (i.e. the contents of a string literal, either half of a \*(C`tr///\*(C'\fR, the second half of an \*(C`s///\*(C'\fR). ``regex'' Filters only the pattern literal parts of a Perl quotelike (i.e. the contents of a \*(C`qr//\*(C'\fR or an \f(CW\*(C`m//\*(C'\fR, the first half of an \f(CW\*(C`s///\*(C'\fR). ``all'' Filters everything. Identical in effect to \*(C`FILTER\*(C'\fR. Except for \*(C`FILTER_ONLY code => sub {...}\*(C'\fR, each of the component filters is called repeatedly, once for each component found in the source code. Note that you can also apply two or more of the same type of filter in a single \*(C`FILTER_ONLY\*(C'\fR. For example, here's a simple macro-preprocessor that is only applied within regexes, with a final debugging pass that prints the resulting source code: use Regexp::Common;
FILTER_ONLY
regex => sub { s/!\[/[^/g },
regex => sub { s/%d/$RE{num}{int}/g },
regex => sub { s/%f/$RE{num}{real}/g },
all => sub { print if $::DEBUG };
Filtering only the code parts of source codeMost source code ceases to be grammatically correct when it is broken up into the pieces between string literals and regexes. So the 'code' and 'code_no_comments' component filter behave slightly differently from the other partial filters described in the previous section. Rather than calling the specified processor on each individual piece of code (i.e. on the bits between quotelikes), the 'code...' partial filters operate on the entire source code, but with the quotelike bits (and, in the case of 'code_no_comments', the comments) ‟blanked out”. That is, a 'code...' filter replaces each quoted string, quotelike, regex, POD, and _ _DATA_ _ section with a placeholder. The delimiters of this placeholder are the contents of the $; variable at the time the filter is applied (normally "\034"). The remaining four bytes are a unique identifier for the component being replaced. This approach makes it comparatively easy to write code preprocessors without worrying about the form or contents of strings, regexes, etc. For convenience, during a 'code...' filtering operation, Filter::Simple provides a package variable ($Filter::Simple::placeholder) that contains a pre-compiled regex that matches any placeholder...and captures the identifier within the placeholder. Placeholders can be moved and re-ordered within the source code as needed. In addition, a second package variable (@Filter::Simple::components) contains a list of the various pieces of $_, as they were originally split up to allow placeholders to be inserted. Once the filtering has been applied, the original strings, regexes, POD, etc. are re-inserted into the code, by replacing each placeholder with the corresponding original component (from @components). Note that this means that the @components variable must be treated with extreme care within the filter. The @components array stores the ‟back− translations” of each placeholder inserted into $_, as well as the interstitial source code between placeholders. If the placeholder backtranslations are altered in @components, they will be similarly changed when the placeholders are removed from $_ after the filter is complete. For example, the following filter detects concatenated pairs of strings/quotelikes and reverses the order in which they are concatenated: package DemoRevCat;
use Filter::Simple;
FILTER_ONLY code => sub {
my $ph = $Filter::Simple::placeholder;
s{ ($ph) \s* [.] \s* ($ph) }{ $2.$1 }gx
};
Thus, the following code: use DemoRevCat;
my $str = "abc" . q(def);
print "$str\n";
would become: my $str = q(def)."abc";
print "$str\n";
and hence print: defabc
Using Filter::Simple with an explicit import subroutineFilter::Simple generates a special \*(C`import\*(C'\fR subroutine for your module (see ‟How it works”) which would normally replace any \*(C`import\*(C'\fR subroutine you might have explicitly declared. However, Filter::Simple is smart enough to notice your existing \*(C`import\*(C'\fR and Do The Right Thing with it. That is, if you explicitly define an \*(C`import\*(C'\fR subroutine in a package that's using Filter::Simple, that \*(C`import\*(C'\fR subroutine will still be invoked immediately after any filter you install. The only thing you have to remember is that the \*(C`import\*(C'\fR subroutine must be declared before the filter is installed. If you use \*(C`FILTER\*(C'\fR to install the filter: package Filter::TurnItUpTo11;
use Filter::Simple;
FILTER { s/(\w+)/\U$1/ };
that will almost never be a problem, but if you install a filtering subroutine by passing it directly to the \*(C`use Filter::Simple\*(C'\fR statement: package Filter::TurnItUpTo11;
use Filter::Simple sub{ s/(\w+)/\U$1/ };
then you must make sure that your \*(C`import\*(C'\fR subroutine appears before that \*(C`use\*(C'\fR statement.
Using Filter::Simple and Exporter togetherLikewise, Filter::Simple is also smart enough to Do The Right Thing if you use Exporter: package Switch;
use base Exporter;
use Filter::Simple;
@EXPORT = qw(switch case);
@EXPORT_OK = qw(given when);
FILTER { $_ = magic_Perl_filter($_) }
Immediately after the filter has been applied to the source, Filter::Simple will pass control to Exporter, so it can do its magic too. Of course, here too, Filter::Simple has to know you're using Exporter before it applies the filter. That's almost never a problem, but if you're nervous about it, you can guarantee that things will work correctly by ensuring that your \*(C`use base Exporter\*(C'\fR always precedes your \*(C`use Filter::Simple\*(C'\fR.
How it worksThe Filter::Simple module exports into the package that calls \*(C`FILTER\*(C'\fR (or \*(C`use\*(C'\fRs it directly) \*(-- such as package \*(L"\s-1BANG\s0\*(R" in the above example \*(-- two automagically constructed subroutines \*(-- \f(CW\*(C`import\*(C'\fR and \f(CW\*(C`unimport\*(C'\fR \*(-- which take care of all the nasty details. In addition, the generated \*(C`import\*(C'\fR subroutine passes its own argument list to the filtering subroutine, so the BANG.pm filter could easily be made parametric: package BANG;
use Filter::Simple;
FILTER {
my ($die_msg, $var_name) = @_;
s/BANG\s+BANG/die '$die_msg' if \${$var_name}/g;
};
# and in some user code:
use BANG "BOOM", "BAM"; # "BANG BANG" becomes: die 'BOOM' if $BAM
The specified filtering subroutine is called every time a \*(C`use BANG\*(C'\fR is encountered, and passed all the source code following that call, up to either the next \*(C`no BANG;\*(C'\fR (or whatever terminator you've set) or the end of the source file, whichever occurs first. By default, any \*(C`no BANG;\*(C'\fR call must appear by itself on a separate line, or it is ignored.
AUTHORDamian Conway
CONTACTFilter::Simple is now maintained by the Perl5−Porters. Please submit bug via the \*(C`perlbug\*(C'\fR tool that comes with your perl. For usage instructions, read \*(C`perldoc perlbug\*(C'\fR or possibly \f(CW\*(C`man perlbug\*(C'\fR. For mostly anything else, please contact <perl5−porters@perl.org>. Maintainer of the CPAN release is Steffen Mueller <smueller@cpan.org>. Contact him with technical difficulties with respect to the packaging of the CPAN module. Praise of the module, flowers, and presents still go to the author, Damian Conway <damian@conway.org>.
COPYRIGHT AND LICENSE Copyright (c) 2000−2008, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the same terms as Perl itself.
0
Johanes Gumabo
Data Size : 59,259 byte
man-Filter::Simple.3pmBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 4 / 165,636
Visitor ID : :
Visitor IP : 18.227.46.202 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|249|Filter::Simple.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|Filter::Simple.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|249|Filter::Simple.3pm|41|br══─}─══|'br══─}─══
) (htmlprn|149|Filter::Simple.3pm|41|'br══─}─══ |'br══─}─══
) (rof_nr_x|149|Filter::Simple.3pm|51/52|\nF|.ie \nF ══─{─══. de IX
) (rof_unit_scale_px|41|Filter::Simple.3pm|51/52|F|.ie \nF ══─{─══. de IX
) (rof_if|19|Filter::Simple.3pm|51/52|\nF|.ie \nF ══─{─══. de IX
) (htmlprn|149|Filter::Simple.3pm|51/52|.ie \nF ══─{─══. de IX|.ie \nF ══─{─══. de IX
) (rof_escape_sequence|91|Filter::Simple.3pm|53|\$1\t\\n%\t"\\$2" |. tm Index:\\$1\t\\n%\t"\\$2"
) (parse_manual_page_|249|Filter::Simple.3pm|57|══─}─══|.══─}─══
) (htmlprn|149|Filter::Simple.3pm|57|.══─}─══ |.══─}─══
) (rof_escape_sequence|91|Filter::Simple.3pm|178|\*(C`use Filter::Util::Call\*(C'\fR. |Set up a module that does a \f(CW\*(C`use Filter::Util::Call\*(C'\fR.
) (rof_escape_sequence|91|Filter::Simple.3pm|180|\*(C`import\*(C'\fR subroutine. |Within that module, create an \f(CW\*(C`import\*(C'\fR subroutine.
) (rof_escape_sequence|91|Filter::Simple.3pm|182|\*(C`import\*(C'\fR subroutine do a call to \f(CW\*(C`filter_add\*(C'\fR, passing |Within the \f(CW\*(C`import\*(C'\fR subroutine do a call to \f(CW\*(C`filter_add\*(C'\fR, passing
) (rof_escape_sequence|91|Filter::Simple.3pm|185|\*(C`filter_read\*(C'\fR or \f(CW\*(C`filter_read_exact\*(C'\fR |Within the subroutine reference, call \f(CW\*(C`filter_read\*(C'\fR or \f(CW\*(C`filter_read_exact\*(C'\fR
) (rof_escape_sequence|91|Filter::Simple.3pm|187|\*(C`use\*(C'\fR your module. Check the status value returned to see if any |\&\f(CW\*(C`use\*(C'\fR your module. Check the status value returned to see if any
) (rof_escape_sequence|91|Filter::Simple.3pm|194|\*(C`no\*(C'\fR) should cause source |If the act of unimporting your module (via a \f(CW\*(C`no\*(C'\fR) should cause source
) (rof_escape_sequence|91|Filter::Simple.3pm|195|\*(C`unimport\*(C'\fR subroutine, and have it call |code filtering to cease, create an \f(CW\*(C`unimport\*(C'\fR subroutine, and have it call
) (rof_escape_sequence|91|Filter::Simple.3pm|196|\*(C`filter_del\*(C'\fR. Make sure that the call to \f(CW\*(C`filter_read\*(C'\fR or |\&\f(CW\*(C`filter_del\*(C'\fR. Make sure that the call to \f(CW\*(C`filter_read\*(C'\fR or
) (rof_escape_sequence|91|Filter::Simple.3pm|197|\*(C`filter_read_exact\*(C'\fR in step 5 will not accidentally read past the |\&\f(CW\*(C`filter_read_exact\*(C'\fR in step 5 will not accidentally read past the
) (rof_escape_sequence|91|Filter::Simple.3pm|198|\*(C`no\*(C'\fR. Effectively this limits source code filters to line-by-line |\&\f(CW\*(C`no\*(C'\fR. Effectively this limits source code filters to line-by-line
) (rof_escape_sequence|91|Filter::Simple.3pm|199|\*(C`import\*(C'\fR subroutine does some fancy |operation, unless the \f(CW\*(C`import\*(C'\fR subroutine does some fancy
) (rof_escape_sequence|91|Filter::Simple.3pm|203|\*(C`BANG\es+BANG\*(C'\fR |\&\s-1BANG\s0.pm. It simply converts every occurrence of the sequence \f(CW\*(C`BANG\es+BANG\*(C'\fR
) (rof_escape_sequence|91|Filter::Simple.3pm|204|\*(C`die \*(AqBANG\*(Aq if $BANG\*(C'\fR in any piece of code following a |to the sequence \f(CW\*(C`die \*(AqBANG\*(Aq if $BANG\*(C'\fR in any piece of code following a
) (rof_escape_sequence|91|Filter::Simple.3pm|205|\*(C`use BANG;\*(C'\fR statement (until the next \f(CW\*(C`no BANG;\*(C'\fR statement, if any): |\&\f(CW\*(C`use BANG;\*(C'\fR statement (until the next \f(CW\*(C`no BANG;\*(C'\fR statement, if any):
) (rof_escape_sequence|91|Filter::Simple.3pm|252|\*(C`use Filter::Simple\*(C'\fR and then |Set up a module that does a \f(CW\*(C`use Filter::Simple\*(C'\fR and then
) (rof_escape_sequence|91|Filter::Simple.3pm|253|\*(C`FILTER { ... }\*(C'\fR. |calls \f(CW\*(C`FILTER { ... }\*(C'\fR.
) (rof_escape_sequence|91|Filter::Simple.3pm|256|\*(C`FILTER\*(C'\fR, process the contents of \f(CW$_\fR to change the source code in |\&\f(CW\*(C`FILTER\*(C'\fR, process the contents of \f(CW$_\fR to change the source code in
) (rof_escape_sequence|91|Filter::Simple.3pm|273|\*(C`^\*(C'\fR or \f(CW\*(C`$\*(C'\fR to detect line boundaries will need the \f(CW\*(C`/m\*(C'\fR flag. |uses \f(CW\*(C`^\*(C'\fR or \f(CW\*(C`$\*(C'\fR to detect line boundaries will need the \f(CW\*(C`/m\*(C'\fR flag.
) (rof_escape_sequence|91|Filter::Simple.3pm|295|\*(C`use Filter::Simple\*(C'\fR |but this can be altered by passing a second argument to \f(CW\*(C`use Filter::Simple\*(C'\fR
) (rof_escape_sequence|91|Filter::Simple.3pm|296|\*(C`FILTER\*(C'\fR (just remember: there's \fIno\fR comma after the initial block when |or \f(CW\*(C`FILTER\*(C'\fR (just remember: there's \fIno\fR comma after the initial block when
) (rof_escape_sequence|91|Filter::Simple.3pm|297|\*(C`FILTER\*(C'\fR). |you use \f(CW\*(C`FILTER\*(C'\fR).
) (rof_escape_sequence|91|Filter::Simple.3pm|299|\*(C`qr\*(C'\fR'd regular expression (which is then |That second argument may be either a \f(CW\*(C`qr\*(C'\fR'd regular expression (which is then
) (rof_escape_sequence|91|Filter::Simple.3pm|375|\*(C`use\*(C'\fR statement that loads |any terminator specification directly to the \f(CW\*(C`use\*(C'\fR statement that loads
) (rof_escape_sequence|91|Filter::Simple.3pm|395|\*(C`FILTER\*(C'\fR subroutine is not exported by Filter::Simple. |except that the \f(CW\*(C`FILTER\*(C'\fR subroutine is not exported by Filter::Simple.
) (rof_escape_sequence|91|Filter::Simple.3pm|426|\*(C`FILTER_ONLY\*(C'\fR subroutine. |exporting the \f(CW\*(C`FILTER_ONLY\*(C'\fR subroutine.
) (rof_escape_sequence|91|Filter::Simple.3pm|428|\*(C`FILTER_ONLY\*(C'\fR takes a sequence of specifiers that install separate |\&\f(CW\*(C`FILTER_ONLY\*(C'\fR takes a sequence of specifiers that install separate
) (rof_escape_sequence|91|Filter::Simple.3pm|441|\*(C`_\|_DATA_\|_\*(C'\fR. The \f(CW\*(C`quotelike\*(C'\fR |code that are not quotelikes, \s-1POD\s0, or \f(CW\*(C`_\|_DATA_\|_\*(C'\fR. The \f(CW\*(C`quotelike\*(C'\fR
) (rof_escape_sequence|91|Filter::Simple.3pm|449|\*(C`_\|_DATA_\|_\*(C'\fR. |\&\f(CW\*(C`_\|_DATA_\|_\*(C'\fR.
) (rof_escape_sequence|91|Filter::Simple.3pm|454|\*(C`_\|_DATA_\|_\*(C'\fR. |comments, or \f(CW\*(C`_\|_DATA_\|_\*(C'\fR.
) (rof_escape_sequence|91|Filter::Simple.3pm|458|\*(C`_\|_DATA_\|_\*(C'\fR. |Filters only those sections of the source code that are not \s-1POD\s0 or \f(CW\*(C`_\|_DATA_\|_\*(C'\fR.
) (rof_escape_sequence|91|Filter::Simple.3pm|462|\*(C`_\|_DATA_\|_\*(C'\fR. |Filters only those sections of the source code that are not \s-1POD\s0, comments, or \f(CW\*(C`_\|_DATA_\|_\*(C'\fR.
) (rof_escape_sequence|91|Filter::Simple.3pm|472|\*(C`tr///\*(C'\fR, the second |contents of a string literal, either half of a \f(CW\*(C`tr///\*(C'\fR, the second
) (rof_escape_sequence|91|Filter::Simple.3pm|473|\*(C`s///\*(C'\fR). |half of an \f(CW\*(C`s///\*(C'\fR).
) (rof_escape_sequence|91|Filter::Simple.3pm|478|\*(C`qr//\*(C'\fR or an \f(CW\*(C`m//\*(C'\fR, the first half of an \f(CW\*(C`s///\*(C'\fR). |contents of a \f(CW\*(C`qr//\*(C'\fR or an \f(CW\*(C`m//\*(C'\fR, the first half of an \f(CW\*(C`s///\*(C'\fR).
) (rof_escape_sequence|91|Filter::Simple.3pm|482|\*(C`FILTER\*(C'\fR. |Filters everything. Identical in effect to \f(CW\*(C`FILTER\*(C'\fR.
) (rof_escape_sequence|91|Filter::Simple.3pm|484|\*(C`FILTER_ONLY code => sub {...}\*(C'\fR, each of |Except for \f(CW\*(C`FILTER_ONLY code => sub {...}\*(C'\fR, each of
) (rof_escape_sequence|91|Filter::Simple.3pm|489|\*(C`FILTER_ONLY\*(C'\fR. For example, here's a simple |a single \f(CW\*(C`FILTER_ONLY\*(C'\fR. For example, here's a simple
) (rof_escape_sequence|91|Filter::Simple.3pm|583|\*(C`import\*(C'\fR subroutine for |Filter::Simple generates a special \f(CW\*(C`import\*(C'\fR subroutine for
) (rof_escape_sequence|91|Filter::Simple.3pm|585|\*(C`import\*(C'\fR subroutine you might have explicitly declared. |\&\f(CW\*(C`import\*(C'\fR subroutine you might have explicitly declared.
) (rof_escape_sequence|91|Filter::Simple.3pm|588|\*(C`import\*(C'\fR and Do The Right Thing with it. |\&\f(CW\*(C`import\*(C'\fR and Do The Right Thing with it.
) (rof_escape_sequence|91|Filter::Simple.3pm|589|\*(C`import\*(C'\fR subroutine in a package |That is, if you explicitly define an \f(CW\*(C`import\*(C'\fR subroutine in a package
) (rof_escape_sequence|91|Filter::Simple.3pm|590|\*(C`import\*(C'\fR subroutine will still |that's using Filter::Simple, that \f(CW\*(C`import\*(C'\fR subroutine will still
) (rof_escape_sequence|91|Filter::Simple.3pm|593|\*(C`import\*(C'\fR subroutine |The only thing you have to remember is that the \f(CW\*(C`import\*(C'\fR subroutine
) (rof_escape_sequence|91|Filter::Simple.3pm|594|\*(C`FILTER\*(C'\fR |\&\fImust\fR be declared \fIbefore\fR the filter is installed. If you use \f(CW\*(C`FILTER\*(C'\fR
) (rof_escape_sequence|91|Filter::Simple.3pm|606|\*(C`use Filter::Simple\*(C'\fR |subroutine by passing it directly to the \f(CW\*(C`use Filter::Simple\*(C'\fR
) (rof_escape_sequence|91|Filter::Simple.3pm|615|\*(C`import\*(C'\fR subroutine appears before |then you must make sure that your \f(CW\*(C`import\*(C'\fR subroutine appears before
) (rof_escape_sequence|91|Filter::Simple.3pm|616|\*(C`use\*(C'\fR statement. |that \f(CW\*(C`use\*(C'\fR statement.
) (rof_escape_sequence|91|Filter::Simple.3pm|639|\*(C`use base Exporter\*(C'\fR always precedes your |ensuring that your \f(CW\*(C`use base Exporter\*(C'\fR always precedes your
) (rof_escape_sequence|91|Filter::Simple.3pm|640|\*(C`use Filter::Simple\*(C'\fR. |\&\f(CW\*(C`use Filter::Simple\*(C'\fR.
) (rof_escape_sequence|91|Filter::Simple.3pm|643|\*(C`FILTER\*(C'\fR |The Filter::Simple module exports into the package that calls \f(CW\*(C`FILTER\*(C'\fR
) (rof_escape_sequence|91|Filter::Simple.3pm|644|\*(C`use\*(C'\fRs it directly) \*(-- such as package \*(L"\s-1BANG\s0\*(R" in the above example \*(-- |(or \f(CW\*(C`use\*(C'\fRs it directly) \*(-- such as package \*(L"\s-1BANG\s0\*(R" in the above example \*(--
) (rof_escape_sequence|91|Filter::Simple.3pm|646|\*(-- \f(CW\*(C`import\*(C'\fR and \f(CW\*(C`unimport\*(C'\fR \*(-- which take care of all the |subroutines \*(-- \f(CW\*(C`import\*(C'\fR and \f(CW\*(C`unimport\*(C'\fR \*(-- which take care of all the
) (rof_escape_sequence|91|Filter::Simple.3pm|649|\*(C`import\*(C'\fR subroutine passes its own argument |In addition, the generated \f(CW\*(C`import\*(C'\fR subroutine passes its own argument
) (rof_escape_sequence|91|Filter::Simple.3pm|668|\*(C`use BANG\*(C'\fR is |The specified filtering subroutine is called every time a \f(CW\*(C`use BANG\*(C'\fR is
) (rof_escape_sequence|91|Filter::Simple.3pm|670|\*(C`no BANG;\*(C'\fR (or whatever terminator you've set) or the |either the next \f(CW\*(C`no BANG;\*(C'\fR (or whatever terminator you've set) or the
) (rof_escape_sequence|91|Filter::Simple.3pm|671|\*(C`no |end of the source file, whichever occurs first. By default, any \f(CW\*(C`no
) (rof_escape_sequence|91|Filter::Simple.3pm|672|\*(C'\fR call must appear by itself on a separate line, or it is ignored. |BANG;\*(C'\fR call must appear by itself on a separate line, or it is ignored.
) (rof_escape_sequence|91|Filter::Simple.3pm|679|\*(C`perlbug\*(C'\fR tool that comes with your perl. |Please submit bug via the \f(CW\*(C`perlbug\*(C'\fR tool that comes with your perl.
) (rof_escape_sequence|91|Filter::Simple.3pm|680|\*(C`perldoc perlbug\*(C'\fR or possibly \f(CW\*(C`man perlbug\*(C'\fR. |For usage instructions, read \f(CW\*(C`perldoc perlbug\*(C'\fR or possibly \f(CW\*(C`man perlbug\*(C'\fR.
)