NAME
Filter::Include - Emulate the behaviour of the C preprocessor's #include
SYNOPSIS
use Filter::Include;
include Foo::Bar;
include "somefile.pl";
## or
#include Some::Class
#include "little/library.pl"
DESCRIPTION
Take the #include
preproccesor directive from C
, stir in some perl
semantics and we have this module. Only one keyword is used, include
, which is really just a processor directive for the filter, which indicates the file to be included. The argument supplied to include
will be handled like it would by require
and use
with the traversing of @INC
and the populating of %INC
and the like.
#include
For those not clued in on what C
's #include
processor directive does this section shall explain briefly its purpose, and why it's being emulated here.
- What
-
When the
C
preprocessor sees the#include
directive, it will include the given file straight into the source. It is syntax-checked and dumped where#include
previously stood, so becomes part of the source of the given file when it is compiled. - Why
-
Basically the 'why' of this module is that I'd seen several requests on Perl Monks, the one which really inspired this was
http://www.perlmonks.org/index.pl?node_id=254283
So I figured other people that haven't posted to Perl Monks may want it, so here it is in all its filtering glory.
Changes
- 1.4
-
Moved out the functionality for locating modules to Module::Locate.
Thanks to the tip off from an Anonymous Monk at
http://www.perlmonks.org/index.pl?node_id=302235
the line numbering is now set accordingly.
- 1.3
-
recursively processes the 'include' directive
moved over to Module::Build, hurrah!
- 1.2
-
Fixed 2 bugs - forgot to
reverse
@dirs
infind_module_file
and_isfh
now checks if an object cangetlines
(notcan
which is silly).
- 1.1
-
Upgraded to a more respectable version number
Added a more robust check for the existence of a filehandle
Added tests for the coderef-type magic in
@INC
when performing a bareword include.Added Changes section in POD
- 0.1
-
Initial release
AUTHOR
Dan Brook <broquaint@hotmail.com>
SEE ALSO
C
, -P in perlrun, Filter::Simple
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 141:
alternative text 'http://www.perlmonks.org/index.pl?node_id=302235' contains non-escaped | or /