=head1 NAME
perlfilter - Source Filters
-
=head1 DESCRIPTION
=head1 CONCEPTS
Before the Perl interpreter can execute a Perl script, it must first
-read it from a file into memory for parsing and compilation. (Even
-scripts specified on the command line with the C<-e> option are stored in
-a temporary file for the parser to process.) If that script itself
-includes other scripts with a C<use> or C<require> statement, then each
-of those scripts will have to be read from their respective files as
-well.
+read it from a file into memory for parsing and compilation. If that
+script itself includes other scripts with a C<use> or C<require>
+statement, then each of those scripts will have to be read from their
+respective files as well.
Now think of each logical connection between the Perl parser and an
individual file as a I<source stream>. A source stream is created when
A source filter is a special kind of Perl module that intercepts and
modifies a source stream before it reaches the parser. A source filter
-changes the our diagram like this:
+changes our diagram like this:
file ----> filter ----> parser
C<decrypt> filter (which unscrambles the source before Perl parses it)
included with the source filter distribution is an example of a C
source filter (see Decryption Filters, below).
-
+
=over 5
package Debug;
use strict;
+ use warnings;
use Filter::Util::Call ;
use constant TRUE => 1 ;
EOM
Such things aside, you can see that a lot can be achieved with a modest
-amount of code. I<[Note that Tuomas' toy VRML parser on p. 17 had the
-same difficulty parsing VRML strings that look like comments. -Jon]>
+amount of code.
=head1 CONCLUSION
Once you can identify individual blocks, try allowing them to be
nested. That isn't difficult either.
-Here is a interesting idea that doesn't involve the Debug filter.
+Here is an interesting idea that doesn't involve the Debug filter.
Currently Perl subroutines have fairly limited support for formal
parameter lists. You can specify the number of parameters and their
type, but you still have to manually take them out of the C<@_> array
CPAN/modules/by-module/Filter
+Starting from Perl 5.8 Filter::Util::Call (the core part of the
+Source Filters distribution) is part of the standard Perl distribution.
+Also included is a friendlier interface called Filter::Simple, by
+Damian Conway.
+
=head1 AUTHOR
Paul Marquess E<lt>Paul.Marquess@btinternet.comE<gt>