NAME

Devel::Examine::Subs::Preprocessor - Provides core pre_proc callbacks for Devel::Examine::Subs

SYNOPSIS

use Devel::Examine::Subs::Preprocessor;

my $compiler = Devel::Examine::Subs::Preprocessor->new;

my $pre_proc = 'module';

if (! $compiler->exists($pre_proc)){
    confess "pre_proc $pre_proc is not implemented.\n";
}

my $compiled_ok = eval {
    $pre_proc_cref = $compiler->{pre_procs}{$pre_proc}->();
    1;
};

DESCRIPTION

Pre-processors run prior to the main processing routine that does the file reading and subroutine compilations.

Use a pre-processor to manipulate the system early in the call chain, or get and return data that doesn't require reading any files.

Use Devel::Examine::Subs pre_proc_return parameter to return the data after the pre-processor has run to avoid unnecessary work by the processor.

METHODS

All methods other than exists() takes an href of configuration data as its first parameter.

exists('pre_proc')

Verifies whether the engine name specified as the string parameter exists and is valid.

module

Mandatory parameters: { module => 'Module::Name' }

This pre-processor returns an array reference of all subroutines within the namespace of the module listed in the module parameter.

The data is returned early as mentioned in the "DESCRIPTION".

inject

Parameters: { inject_use => ['use statement1;', 'use statement2;'] } or { inject_after_sub_def => ['code line 1;', 'code line 2;'] } or { line_num => $num, code = \@code }>

Injects each element of the array ref as either a use statement, lines of code after a sub definition, or a block of code immediately after the line number.

remove

Parameters: delete => 'string'

Deletes the entire line of code, if it contains 'string'.

AUTHOR

Steve Bertrand, <steveb at cpan.org>

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Devel::Examine::Subs

LICENSE AND COPYRIGHT

Copyright 2017 Steve Bertrand.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.