.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Test::HexDifferences::HexDump 3pm" .TH Test::HexDifferences::HexDump 3pm "2020-08-04" "perl v5.30.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Test::HexDifferences::HexDump \- Format binary to hexadecimal strings .SH "VERSION" .IX Header "VERSION" 0.008 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Test::HexDifferences::HexDump; \& \& $string = hex_dump( \& $binary, \& ); \& \& $string = hex_dump( \& $binary, \& { \& address => $start_address, \& format => "%a : %4C : %d\en", \& } \& ); .Ve .SS "Format elements" .IX Subsection "Format elements" Every format element in the format string is starting with % like sprintf. .PP If the given format is shorter defined as needed for the data length the remaining data are displayed in default format. If the given format is longer defined as the data length the output will filled with space and it stops before next repetition. .PP \fIData format\fR .IX Subsection "Data format" .PP It is not very clever to use little-endian formats for tests. There is a fallback to bytes if multibyte formats can not displayed. .PP .Vb 10 \& %C \- unsigned char \& %S \- unsigned 16\-bit, endian depends on machine \& %S< \- unsigned 16\-bit, little\-endian \& %S> \- unsigned 16\-bit, big\-endian \& %v \- unsigned 16\-bit, little\-endian \& %n \- unsigned 16\-bit, big\-endian \& %L \- unsigned 32\-bit, endian depends on machine \& %L< \- unsigned 32\-bit, little\-endian \& %L> \- unsigned 32\-bit, big\-endian \& %V \- unsigned 32\-bit, little\-endian \& %N \- unsigned 32\-bit, big\-endian \& %Q \- unsigned 64\-bit, endian depends on machine \& %Q< \- unsigned 64\-bit, little\-endian \& %Q> \- unsigned 64\-bit, big\-endian .Ve .PP \&\*(L"pack\*(R" and \*(L"unpack\*(R" before Perl v5.10 do not allow \*(L"<\*(R" and \*(L">\*(R" to mark the byte order. This is allowed here for all Perl versions. .PP \&\*(L"pack\*(R" and \*(L"unpack\*(R" on a 32 bit machine do not allow the \*(L"Q\*(R" formats. This is allowed here for all machines. .PP \fIAddress format\fR .IX Subsection "Address format" .PP .Vb 3 \& %a \- 16 bit address \& %4a \- 16 bit address \& %8a \- 32 bit address .Ve .PP \fI\s-1ASCII\s0 format\fR .IX Subsection "ASCII format" .PP It can not display all chars. First it must be a printable \s-1ASCII\s0 char. It can not be anything of space, q{.}, q{'}, q{"} or q{\e}. Otherwise q{.} will be printed. .PP .Vb 1 \& %d \- display ASCII .Ve .PP \fIRepetition\fR .IX Subsection "Repetition" .PP .Vb 4 \& %*x \- repetition endless \& %1x \- repetition 1 time \& %2x \- repetition 2 times \& ... .Ve .PP \fISpecial formats\fR .IX Subsection "Special formats" .PP .Vb 1 \& %\en \- ignore \en .Ve .SS "Default format" .IX Subsection "Default format" The default format is: .PP .Vb 1 \& "%a : %4C : %d\en" .Ve .PP or fully written as .PP .Vb 1 \& "%a : %4C : %d\en%*x" .Ve .SS "Complex formats" .IX Subsection "Complex formats" The %...x allows to write mixed formats e.g. .PP .Vb 11 \& Format: \& %a : %N %4C : %d\en%1x% \& %a : %n %2C : %d\en%*x \& Input: \& \e0x01\e0x23\e0x45\e0x67\e0x89\e0xAB\e0xCD\e0xEF \& \e0x01\e0x23\e0x45\e0x67 \& \e0x89\e0xAB\e0xCD\e0xEF \& Output: \& 0000 : 01234567 89 AB CD EF : .#\-Eg... \& 0008 : 0123 45 67 : .#\-E \& 000C : 89AB CD EF : g... .Ve .SH "EXAMPLE" .IX Header "EXAMPLE" Inside of this Distribution is a directory named example. Run this *.t files. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a formatter for binary data. .SH "SUBROUTINES/METHODS" .IX Header "SUBROUTINES/METHODS" .SS "subroutine hex_dump" .IX Subsection "subroutine hex_dump" .Vb 7 \& $string = hex_dump( \& $binary, \& { \& address => $display_start_address, \& format => $format_string, \& } \& ); .Ve .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" nothing .SH "CONFIGURATION AND ENVIRONMENT" .IX Header "CONFIGURATION AND ENVIRONMENT" nothing .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" Hash::Util .PP Sub::Exporter .SH "INCOMPATIBILITIES" .IX Header "INCOMPATIBILITIES" none .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" none .SH "SEE ALSO" .IX Header "SEE ALSO" Test::HexDifferences .PP Data::Hexdumper inspired by .SH "AUTHOR" .IX Header "AUTHOR" Steffen Winkler .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright (c) 2012 \- 2014, Steffen Winkler \&\f(CW\*(C`\*(C'\fR. All rights reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.