Note: Since these functions are used during the Perl build process, they must work with miniperl. That necessarily implies that these functions must not rely on XS modules, either directly or indirectly (e.g., autodie).

SUBROUTINES

my_die()

Purpose

Exit from a process with an error code and a message.

Arguments

List of arguments to be passed with the error message. Example:

close $fh or my_die("close 'utils.lst': $!");

Return Value

Exit code 255.

Comment

Prints ABORTED to STDERR.

open_or_die()

Purpose

Opens a file or fails if it cannot.

Arguments

String holding filename to be opened. Example:

$fh = open_or_die('utils.lst');

Return Value

Handle to opened file.

slurp_or_die()

Purpose

Read the contents of a file into memory as a single string.

Arguments

String holding name of file to be read into memory.

$olddelta = slurp_or_die('pod/perldelta.pod');

Return Value

String holding contents of file.

write_or_die()

Purpose

Write out a string to a file.

Arguments

List of two arguments: (i) String holding name of file to be written to; (ii) String holding contents to be written.