Strips most carp::datum calls lexically
use Carp::Datum::Strip qw(datum_strip); datum_strip("-", "-"); datum_strip($file, "$file.new", ".bak");
This module exports a single routine, datum_strip(), whose purpose is to remove calls to \*(C`Carp::Datum\*(C' routines lexically.
Because stripping is done lexically, there are some restrictions about what is actually supported. Unless the conventions documented in Carp::Datum are followed, stripping will be incorrect.
The general guidelines are:
Do not use here documents or generalized quotes (qq) within assertion expression or tags. Write assertions using '' or "", as appropriate.
Assertions can be safely put on several lines, but must end with a semi-colon, outside any string.
There are two calls that will never be stripped: \s-1VERIFY\s0() and \s-1DTRACE\s0(). The \s-1VERIFY\s0() is meant to be preserved (or \*(C`DREQUIRE\*(C' would have been used). \*(C`DTRACE\*(C', when called, will be remapped dynamically to some \*(C`Log::Agent\*(C' routine, depending on the trace level. See Carp::Datum for details.
The interface of the datum_strip() routine is: The old_file specifies the old file path, the one to be stripped. The stripped version will be written to new_file. If the optional third argument ext is given (e.g. \*(L".bak\*(R"), then old_file will be renamed with the supplied extension, and new_file will be renamed old_file. Renaming only occurs if stripping was successful (i.e. the new file was correctly written to disk). The lowest nine \*(L"rwx\*(R" mode bits from old_file are preserved when creating new_file. Both old_file and new_file can be set to \*(L"-\*(R", in which case \s-1STDIN\s0 and \s-1STDOUT\s0 are used, respectively, and no renaming can occur, nor any mode bit propagation. Returns true on success, \*(C`undef\*(C' on error.
Christophe Dehaudt and Raphael Manfredi are the original authors.
Send bug reports, hints, tips, suggestions to Dave Hoover at <[email protected]>.
Carp::Datum\|(3).