Parrot::Configure::Step - Configuration Step Utilities
The Parrot::Configure::Step module contains utility functions for steps to use.
Parrot::Configure::Step
Note that the actual configuration step itself is NOT an instance of this class, rather it is defined to be in the package Configure::Step. See docs/configuration.pod for more information on how to create new configuration steps.
package
Configure::Step
integrate($orig, $new)
Integrates $new into $orig. Returns $orig if $new is undefined.
$new
$orig
prompt($message, $value)
Prints out "message [default] " and waits for the user's response. Returns the response, or the default if the user just hit ENTER.
ENTER
file_checksum($filename, $ignore_pattern)
Creates a checksum for the specified file. This is used to compare files.
Any lines matching the regular expression specified by $ignore_pattern are not included in the checksum.
$ignore_pattern
copy_if_diff($from, $to, $ignore_pattern)
Copies the file specified by $from to the location specified by $to if its contents have changed.
$from
$to
The regular expression specified by $ignore_pattern is passed to file_checksum() when comparing the files.
file_checksum()
move_if_diff($from, $to, $ignore_pattern)
Moves the file specified by $from to the location specified by $to if its contents have changed.
genfile($source, $target, %options)
Takes the specified source file, replacing entries like @FOO@ with FOO's value from the configuration system's data, and writes the results to specified target file.
@FOO@
FOO
Respects the following options when manipulating files (Note: most of the replacement syntax assumes the source text is on a single line.)
If set to a true value, this flag sets (unless overriden) comment_type to '#', replace_slashes to enabled, and conditioned_lines to enabled.
comment_type
replace_slashes
conditioned_lines
If the name of the file being generated ends in Makefile, this option defaults to true.
Makefile
If conditioned_lines is true, then lines in the file that begin with: #CONDITIONED_LINE(var): are skipped if the var condition is false. Lines that begin with #INVERSE_CONDITIONED_LINE(var): are skipped if the var condition is true.
#CONDITIONED_LINE(var):
#INVERSE_CONDITIONED_LINE(var):
This option takes has two possible values, # or /*. If present and set to one of these two values, the generated file will contain a generated header that is commented out appropriately.
#
/*
A regular expression. Any lines in the file matching this expression are ignored when determining if the target file has changed (and should therefore be overwritten with a new copy).
When feature_file is set to a true value, a lines beginning with #perl forces the remaining lines of the file to be evaluated as perl code. Before this evaluation occurs, any substitution of @@ values is performed on the original text.
#perl
If set to a true value, this causes any /s in the file to automatically be replaced with an architecture appropriate slash. / or \. This is a very helpful option when writing Makefiles.
/
\
If set to a true value, then certain types of gmake syntax will be expanded into their full equivalents. For example:
$(wildcard PATTERN)
Will be replaced at config time with the list of files that match this pattern. Note! Be very careful when determining whether or not to disable this expansion during config time and letting gmake evaluate these: the config system itself may change state of the filesystem, causing the directives to expand differently depending on when they're run. Another potential issue to consider there is that most makefiles, while generated from the root directory, are run from a subdirectory. So relative path names become an issue.
The gmake replacements are done repeatedly on a single line, so nested syntax works ok.
_run_command($command, $out, $err)
Runs the specified command. Output is directed to the file specified by $out, warnings and errors are directed to the file specified by $err.
$out
$err
_build_compile_command( $cc, $ccflags, $cc_args )
Constructs a command-line to do the compile.
cc_gen($source)
Generates test.c from the specified source file.
cc_build($cc_args, $link_args)
These items are used from current config settings:
$cc, $ccflags, $ldout, $o, $link, $linkflags, $cc_exe_out, $exe, $libs
Calls the compiler and linker on test.c.
cc_run()
Calls the test (or test.exe) executable. Any output is directed to test.out.
cc_run_capture()
Same as cc_run() except that warnings and errors are also directed to test.out.
cc_clean()
Cleans up all files in the root folder that match the glob test.*.
capture_output($command)
Executes the given command. The command's output (both stdout and stderr), and its return status is returned as a 3-tuple. STDERR is redirected to test.err during the execution, and deleted after the command's run.
check_progs([$programs])
Where $programs may be either a scalar with the name of a single program or an array ref of programs to search the current PATH for. The first matching program name is returned or undef on failure. Note: this function only returns the name of the program and not its complete path.
$programs
PATH
undef
This function is similar to autoconf's AC_CHECK_PROGS macro.
autoconf
AC_CHECK_PROGS
_slurp($filename)
Slurps $filename into memory and returns it as a string.
$filename
Parrot::Configure::RunSteps
To install Parrot::Op, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parrot::Op
CPAN shell
perl -MCPAN -e shell install Parrot::Op
For more information on module installation, please visit the detailed CPAN module installation guide.