Devel::MAT::Cmd(3pm) | User Contributed Perl Documentation | Devel::MAT::Cmd(3pm) |
"Devel::MAT::Cmd" - abstractions for providing commands for "Devel::MAT"
Devel::MAT::Cmd->printf( $fmt, @args )
Behaves like perl's core "printf()" function. Additionally, any argument for a %s conversion may also be the result of one of the following "format_*" methods, which may return a String::Tagged instance.
Devel::MAT::Cmd->print_table( $rows, %opts )
Given a 2D array-of-arrays containing strings (which may be plain or formatted ones returned by the various "format_*" methods), prints them formatted in a table shape, aligning the columns.
An element of $rows may be an empty arrayref. This will cause a row of divisions to be drawn using hyphens ("-") the full width of each column.
The following named %ops may be supplied:
$str = Devel::MAT::Cmd->format_note( $str, $idx )
Apply some sort of styling to the a given string.
Starting from zero, successively higher integer values for $idx may influence the style further. Output with the same index value will appear the same. The implementation should support at least 3 different styles, but may wrap after this.
For stylistic consistency, tools should try to stick to the following conventions for note indexes:
0 - regular notes 1 - secondary notes, lexical variable names 2 - unusual or erroneous conditions, symbol table names
$str = Devel::MAT::Cmd->format_sv( $sv )
Returns a string encoding the address and description of the given SV, possibly stylised in some way, subject to user customisation, or possibly made interactive if the UI allows it to be so.
$str = Devel::MAT::Cmd->format_value( $val, %opts )
Returns a string formatting a given plain scalar value (which should either be a string or a number) to indicate it's a value from the user program. If given a string value, this will be escaped and quoted appropriately.
The following named %opts may be supplied:
$str = Devel::MAT::Cmd->format_symbol( $name, $sv )
Returns a string formatting the given symbol name to indicate that it is a symbol name. Optionally, the SV object itself can be passed too, which may save the UI having to look it up from the dumpfile in case it wishes to make the printed value interactive in some way.
$str = Devel::MAT::Cmd->format_bytes( $bytes )
Returns a string showing the given byte count in suitably scaled units. This will use base-1024 sizes in "KiB", "MiB", "GiB" or "TiB" if necessary.
$str = Devel::MAT::Cmd->format_sv_with_value( $sv )
Similar to "format_sv", but printing additional information on some kinds of SVs to avoid the user needing to use the "show" to identify it.
For "SCALAR" SVs it will show the value directly by using "format_value", for "REF" SVs it will show the referrant SV, and for "STASH" SVs it will show the symbol name.
$str = Devel::MAT::Cmd->format_heading( $text, $level )
Returns a string applying some formatting to the given text to make it stand out as a section or table heading. $level may be used to distinguish different styles; at least 3 should be provided.
Paul Evans <leonerd@leonerd.org.uk>
2023-03-26 | perl v5.36.0 |