Devel-Examine-Subs
view release on metacpan or search on metacpan
calls on the same object) and if false, the param is transient, and
will be made undef after each method call finishes.
run
Parameter format: Hash reference
All public methods call this method internally. This is the only public
method that takes its parameters as a single hash reference. The public
methods set certain variables (filters, engines etc). You can get the
same effect programatically by using run(). Here's an example that
performs the same operation as the has() public method:
my $params = {
search => 'text',
post_proc => 'file_lines_contain',
engine => 'has',
};
my $return = $des->run($params);
This allows for very fine-grained interaction with the application, and
makes it easy to write new engines and for testing.
add_functionality
WARNING!: This method is for development of this distribution only!
While writing new processors, set the processor type to a callback
within the local working file. When the code performs the actions you
want it to, put a comment line before the code with #<des> and a line
following the code with #</des>. DES will slurp in all of that code
live-time, inject it into the specified processor, and configure it for
use. See examples/write_new_engine.pl for an example of creating a new
'engine' processor.
Returns 1 on success.
Parameters:
add_functionality
Informs the system which type of processor to inject and configure.
Permitted values are 'pre_proc', 'post_proc' and 'engine'.
add_functionality_prod
Set to a true value, will update the code in the actual installed
Perl module file, instead of a local copy.
Optional parameters:
copy
Set it to a new file name which will be a copy of the specified file,
and only change the copy. Useful for verifying the changes took
properly.
pre_procs, post_procs, engines
For development. Returns the list of the respective built-in callbacks.
PARAMETERS
There are various parameters that can be used to change the behaviour
of the application. Some are persistent across calls, and others
aren't. You can change or null any/all parameters in any call, but some
should be set in the new() method (set it and forget it).
The following list are persistent parameters, which need to be manually
changed or nulled. Consider setting these in new().
file
State: Persistent
Default: None
The name of a file, directory or module name. Will convert module
name to a file name if the module is installed on the system. It'll
require the module temporarily and then 'un'-require it immediately
after use.
If set in new(), you can omit it from all subsequent method calls
until you want it changed. Once changed in a call, the updated value
will remain persistent until changed again.
backup
State: Persistent
Default: Disabled
Set this to a true value to have a .bak file copy created on all file
reads. The .bak file will be created in the directory the script is
run in.
extensions
State: Persistent
Default: ['*.pm', '*.pl')]
By default, we load only *.pm and *.pl files. Use this parameter to
load different files. Only useful when a directory is passed in as
opposed to a file. This parameter is persistent until manually reset
and should be set in new().
Values: Array reference where each element is the names of files to
find. Any wildcard or regex that are valid in File::Find::Rule's
<http://search.cpan.org/~rclamp/File-Find-Rule-0.33/lib/File/Find/Rul
e.pm> are valid here. For example, [qw(*.pm *.pl)] is the default.
maxdepth
When running in directory mode, how many levels deep do you want to
traverse? Default is unlimited. Set to a positive integer to set.
cache
State: Persistent
negative integer to inject after all.
pre_proc_dump, post_proc_dump, engine_dump, cache_dump, core_dump
State: Transient
Default: Disabled
Set to 1 to activate, exit()s after completion.
Print to STDOUT using Data::Dumper the structure of the data
following the respective phase. The core_dump will print the state of
the data, as well as the current state of the entire DES object.
NOTE: The 'post_proc' phase is run in such a way that the filters can
be daisy-chained. Due to this reason, the value of post_proc_dump
works a little differently. For example:
post_proc => ['one', 'two'];
...will execute filter 'one' first, then filter 'two' with the data
that came out of filter 'one'. Simply set the value to the number
that coincides with the location of the filter. For instance,
post_proc_dump => 2; will dump the output from the second filter and
likewise, 1 will dump after the first.
For cache_dump, if it is set to one, it'll dump cache but the
application will continue. Set this parameter to an integer larger
than one to have the application exit immediately after dumping the
cache to STDOUT.
pre_proc_return, post_proc_return, engine_return
State: Transient
Default: Disabled
Returns the structure of data immediately after being processed by
the respective phase. Useful for writing new 'phases'. (See "SEE
ALSO" for details).
NOTE: post_proc_return does not behave like post_proc_dump. It will
only return after all post_procs have executed.
config_dump
State: Transient
Default: Disabled
Prints to STDOUT with Data::Dumper the current state of all loaded
configuration parameters.
pre_proc, post_proc, engine
State: Transient
Default: undef
These are mainly used to set up the public methods with the proper
callbacks used by the run() command.
engine and pre_proc take either a single string that contains a valid
built-in callback, or a single code reference of a custom callback.
post_proc works a lot differently. These modules can be
daisy-chained. Like engine and pre_proc, you can send in a string or
cref, or to chain, send in an aref where each element is either a
string or cref. The filters will be executed based on their order in
the array reference.
REPOSITORY
https://github.com/stevieb9/devel-examine-subs
BUILD REPORTS
CPAN Testers: http://matrix.cpantesters.org/?dist=Devel-Examine-Subs
DEBUGGING
If Devel::Trace::Subs is installed, you can configure stack tracing.
In your calling script, set $ENV{DES_TRACE} = 1.
See perldoc Devel::Trace::Subs for information on how to access the
traces.
SEE ALSO
perldoc Devel::Examine::Subs::Preprocessor
Information related to the 'pre_proc' phase core modules.
perldoc Devel::Examine::Subs::Postprocessor
Information related to the 'post_proc' phase core modules.
perldoc Devel::Examine::Subs::Engine
Information related to the 'engine' phase core modules.
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 2016-2020 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.
( run in 0.986 second using v1.01-cache-2.11-cpan-5a3173703d6 )