Devel::PreProcessor

Devel::PreProcessor is a Perl module inlining and other Perl source manipulations.
Download

Devel::PreProcessor Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Matthew Cavalletto
  • Publisher web site:
  • http://search.cpan.org/~evo/Devel-PreProcessor-2003.1128/PreProcessor.pm

Devel::PreProcessor Tags


Devel::PreProcessor Description

Devel::PreProcessor is a Perl module inlining and other Perl source manipulations. Devel::PreProcessor is a Perl module inlining and other Perl source manipulations.SYNOPSISFrom a command line, sh> perl Devel/PreProcessor.pm -Flags sourcefile > targetfileOr in a Perl script, use Devel::PreProcessor qw( Flags ); select(OUTPUTFH); Devel::PreProcessor::parse_file( $source_pathname );This package processes Perl source files and outputs a modified version acording to several user-setable option flags, as detailed below.Each of the flag names listed below can be used as above, with a hyphen on the command line, or as one of the arguments in an import statement. Each of these flags are mapped to the scalar package variable of the same name.Includes If true, parse_file will attempt to replace require, use and no statements with inline declarations containg the source of the relevant library found in the current @INC. The resulting script should operate identically and no longer be dependant on external libraries (but see compatibility note below). If the corresponding file can not be located, the statements are left unchanged in the source; numeric perl version requirements are handled the same way. If a use libs ... statement is encountered in the source, the library path arguments are evaluated and pushed onto @INC at run-time to enable inclusion of libraries from these paths. Unless the file explicitly use's or require's AutoLoader, information after __END__ is not included in the resultant file. Information after __DATA__ is also discarded, except for the first, outermost source file.ShowFileBoundaries If true, comment lines will be inserted delimiting the start and end of each inlined file.StripPods If true, parse_file will not include POD from the source files. All groups of lines resembling the following will be discarded: =(pod|head1|head2) ... =cutStripBlankLines If true, parse_file will skip lines that are empty, or that contain only whitespace.StripComments If true, parse_file will not include full-line comments from the source files. Only lines that start with a pound sign are discarded; this behaviour might not match Perl's parsing rules in some cases, such as multiline strings.Conditionals If true, parse_file will utilize a simple conditional inclusion scheme, as follows. #__CONDITIONAL__ if expr ... #__CONDITIONAL__ endif The provided Perl expression is evaluated, and unless it is true, everything up to the next endif declaration is replaced with empty lines. In order to allow the default behavour to be provided when running the raw files, comment out lines in non-default branches with the following: #__CONDITIONAL__ ... Empty lines are used in place of skipped blocks to make line numbers come out evenly, but conditional use or require statements will throw the count off, as we don't pad by the size of the file that would have been in-lined. The conditional functionality can be combined with Perl's -s switch, which allows you to set flags on the command line, such as: perl -s Devel/PreProcessor.pm -Conditionals -Switch filter.test You can use any name for your switch, and the matching scalar variable will be set true; the following code will only be used if you supply the argument as shown below. #__CONDITIONAL__ if $Switch #__CONDITIONAL__ print "you hit the switch!n"; #__CONDITIONAL__ endif Requirements: · Perl


Devel::PreProcessor Related Software