|
PPrint - Programmable sprintf. Allows you to associate functions to directives and supplies fairly powerful default directives. |
PPrint - Programmable sprintf. Allows you to associate functions to directives and supplies fairly powerful default directives.
use PPrint;
pprint("~2r", 8) => "1000"
PPrint provides a number of default directives.
~RADIX,MINCOL,PADCHAR,COMMAINTERVAL,COMMCHAR:;!R
Generic integer formating.
Parameters:
RADIXMINCOL extra PADCHAR
chars will be added to the left of the string in order to make it
MINCOL columns long. Defaults to '0'.
COMMACHARFlags:
:COMMACHAR chars at intervals
COMMAINTERVAL chars.
;!
~MINCOL,PADCHAR,COMMAINTERVAL,COMMACHAR:;!D
Same as R directive with RADIX = 10.
~MINCOL,PADCHAR,COMMAINTERVAL,COMMACHAR:;!O
Same as R directive with RADIX = 8.
~MINCOL,PADCHAR,COMMAINTERVAL,COMMACHAR:;!X
Same as R directive with RADIX = 16.
~MINCOL,PADCHAR,COMMAINTERVAL,COMMACHAR:;!X
Same as R directive with RADIX = 2.
~REPEAT,TYPEn
Prints newlines.
Note that this directive consumes no elements from the arg list,
unless 'v is used for REPEAT or TYPE of course.
Parameters:
REPEATTYPE'u => unix (chr 0x0A), 'd
=> dos (chr(x0D) . chr(0x0A)), ``m'' => mac (chr 0x0D).
~REPEAT~
Prints tilde chars.
Parameter:
REPEAT
~S
Printing strings, just like sprintf(``%s'', $arg);
~INDENT_STYLE,PURITY,USEQQ,TERSE,DEEPCOPY,QUOTEKEYS,MAXDEPTH A
Print with Data::Dumper. see the Data::Dumper man page for what the various options mean.
One of the main reasons PPrint was written was to provide a way to
customize how data should be printed, to this end PPrint can be
extended to understand new directives.
FIXME: Describe it here. In the mean time look at the tilde and n directives.
Ideas liberally taken from Common Lisp's format directive.
|
PPrint - Programmable sprintf. Allows you to associate functions to directives and supplies fairly powerful default directives. |