P, Pe, Pa, Pae Safer, General Format + Print sub
Version "1.0.10"
Combined printf, sprintf & say in 1 routine (almost). Can safely handle *args* to formmatted strings that are 'undef' & will print '(undef)' in place of the output. It knows how to print simple references and does so automatically rather than HASH=(0x235432), at the 1st level, it will print the contents of the hash: {none=>0, one=>1, two=>2}. Meant for use in development and as debug aid. Made executable and run, it does a small self-demo/test. Pod-documentation also builtin.
While designed to speed up and simplify development, isn't limited to such.
It tries to auto-handle adding Newlines at the end of a line, substrating or adding LF's at the end depending on the circumstance. When you print vars via a string format, "undef" is handled 'in-line', with (undef) being printed in fields (though it is likely to retrn a 0 for numeric formats at this time.
The auto-newline feature at the end of a line can be supressed by adding the Unicode control char "Don't break here" (0x83) at the end of a string.
Any items printed as strings that are undef -- will print '(undef)'.
Note, values given as args to a formatted print statement, are checked for undef and substitute "(undef)" for undefined values. If you print vars as numbers, this can have the side effect of causing runtime format errors, so best to print as strings to see 'undef'. While usable in any code, it's use was designed to save typing, time and work of undef checking, newline handling, and doing the right thing with given input. It may not be suitable where speed is important.
To install P, copy and paste the appropriate command in to your terminal.
cpanm
cpanm P
CPAN shell
perl -MCPAN -e shell install P
For more information on module installation, please visit the detailed CPAN module installation guide.