NAME
stubby - commandline tool for dumping stub Perl programs sequentialized using Sub::Genius.
SYNOPSIS
Generate code that is dependent on Sub::Genius:
Example redirects to a file, ./spawn-combine.pl
$ stubby init --run once -p "can bejust a list of subroutines" > ./spawn-combine.pl
Generate code that is not dependent on Sub::Genius:
Example redirects to a file, ./spawn-combine.pl
$ stubby init --run nodeps -p "init ( subA & subB ) middle ( subA & suB ) fin" > ./spawn-combine.pl
Note: while this necessarily causes a PRE to be cached, the code generated also doesn't use Sub::Genius ();, so the caching effect on this subcommand is only as useful for making this command faster. See precache subcommand below for a more useful approach for caching.
Pre-cache PREs (may be reasonably called, a compile step):
precache outputs the absolute path to the cache file on completion.
$ CACHEFILE=$(stubby precache -p "init (subA & subB ) middle (subC & subD) fin")
$ echo Cache file is ${CACHEFILE}
$ CACHEFILE=$(stubby precache -f ./my-preplan.preplan -d put/in/here)
$ echo Cache file is ${CACHEFILE}
Note: ./my-preplan.preplan should generate the same checksum (and cache) as the PRE specified using -p in the first example.
init
(subA & subB )
middle
(subC & subD)
fin
Sub::Genius tries very hard to generate a consistent representation of the PREs, basically by minifying them.
DESCRIPTION
General commandline tool for doing usefuly things while developing or distributing applications that use Sub::Genius.
export - dumps the minimized DFA resulting from the PRE in GraphViz's dot format. Useful with programs such as xdot, which is a viewer; in addition to the rendering programs provided by GraphViz, such as dot, circo, etc.
init - generates boilerplate Perl to help start a script, module, or project that is using Sub::Genius.
list - enumerates all valid strings accepted by the PRE that is provided; this is useful for verifying all of the orderings in which the PRE describes the serialized execution plan.
precache - provides a compiler-like tool for precaching PREs that Sub::Genius is able to use natively for skipping the potentially expensive step of convering a PRE (preplan) to a DFA (the thing FLAT uses to generate valid (i.e., sequentially consistent) execution plans.
OPTIONS FOR SUBCOMMAND export
-f|--prefilepath/to/PRE.preplan-
Specify the PRE from a file. Mutually exclusive with
-p|--preplan. -p|--preplanPRE-
An the actual PRE that is to be cached. Mutually exclusive with
-f|--prefile, which can be used to specify a PRE in a text file.
OPTIONS FOR SUBCOMMAND init
The init subcommand does not convert a PRE to a DFA, it simply takes a space delimited list of subroutine names, that are then used to generate minimal subroutine stubs. It is then a starting point for the developer of the code to manually edit the PRE (contained as a scalar string, $preplan) and implement the bodies of the subroutines.
-x|--run-
Choose invocation method to use in the code. The default is
once.Options include:
once- generates code that invokesSub::Genius::run_once.any- generates code that invokesSub::Genius::run_any.all- generates code that invokesSub::Genius::run_once, in ado { ... } while ()loop.nodeps- generates code that is free of any dependencies, includingSub::Genius. -p|--preplan-
An actual PRE, when used with
-x|--run[ once | any | all ], the subroutine names are stripped and used, but the PRE is not converted to a DFA.when used with
-x|--run nodeps, the PRE is necessarily generates subroutine calls that must necessarily be sequentially consistent. -f|--prefile-
Specify the PRE from a file. Mutually exclusive with
-p|--preplan.
OPTIONS FOR SUBCOMMAND list
-f|--prefilepath/to/PRE.preplan-
Specify the PRE from a file. Mutually exclusive with
-p|--preplan. -p|--preplanPRE-
An the actual PRE that is to be cached. Mutually exclusive with
-f|--prefile, which can be used to specify a PRE in a text file.
OPTIONS FOR SUBCOMMAND precache
Effectively compiles a PRE using Sub::Genius's caching feature. As long as PREs that produced the same checksum by Sub::Genius and the cachedir is the same, this allows one to prepare and distribute any number of pre-compiled DFAs. For sufficiently large or highly shuffled PREs, this can be leveraged to virtually eliminate the overhead associated with using Sub::Genius in deployed code..
-d|--cachedirpath/to/cachedir-
Specifies the
cachedirto use for saving the cached DFAs. See Sub::Genius for more information about caching. This option is passed to thecachedirparameter of the constructor. -f|--prefilepath/to/PRE.preplan-
Specify the PRE from a file. Mutually exclusive with
-p|--preplan. -p|--preplanPRE-
An the actual PRE that is to be cached. Mutually exclusive with
-f|--prefile, which can be used to specify a PRE in a text file. --force-
Forces re-caching of previously cached DFAs, or at least for those matching the
checksumand are located in the samecachedir.
SEE ALSO
BUGS
Probably
COPYRIGHT AND LICENSE
perl5
AUTHOR
OODLER 577 <oodler@cpan.org>