Build::Hopen::Phases - Definitions and routines for hopen phases
Definition of hopen phases. Phase names are case-insensitive. The canonical form has only the first letter capitalized.
Phase names may only contain ASCII letters, digits, or underscore. The first character of a phase may not be a digit. This is so they can be used as identifiers if necessary.
This package also defines a special export tag, :hopenfile, for use when running hopen files. The wrapper code in Build::Hopen::App uses this tag. Hopen files themselves do not need to use this tag.
:hopenfile
The phases we know about, in order.
Return truthy if the given argument is the name of a phase we know about.
Return truthy if the argument is the name of the last phase.
Get the index of the phase given as a parameter. Returns undef if none. Phases are case-insensitive.
Get the phase after the given on. Returns undef if the argument is the last phase. Dies if the argument is not a phase.
Take a given action only in a specified phase. Usage examples:
on check => { foo => 42 }; # Just return the given hashref on gen => 1337; # Returns { Gen => 1337 } on check => sub { return { foo => 1337 } }; # Call the given sub and return its return value.
This is designed for use within a hopen file. See "_run_phase" in Build::Hopen::App for the execution environment on() is designed to run in.
on()
When run as part of a hopen file, on() will skip the rest of the file if it runs. For example:
say "Hello, world!"; # This always runs on check => { answer => $answer }; # This runs during the Check phase on gen => { done => true }; # This runs during the Gen phase say "Phase was neither Check nor Gen"; # Doesn't run in Check or Gen
To install Build::Hopen, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Build::Hopen
CPAN shell
perl -MCPAN -e shell install Build::Hopen
For more information on module installation, please visit the detailed CPAN module installation guide.