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
Cpreprocessor sees the#includedirective, it will include the given file straight into the source. It is syntax-checked and dumped where#includepreviously 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.2
-
Fixed 2 bugs - forgot to
reverse@dirsinfind_module_fileand_isfhnow checks if an object cangetlines(notcanwhich 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
@INCwhen 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