|
NAMEData::Hexdumper - Make binary data human-readableSYNOPSISuse Data::Hexdumper qw(hexdump); print hexdump( data => $data, # what to dump # NB number_format is deprecated number_format => 'S', # display as unsigned 'shorts' start_position => 100, # start at this offset ... end_position => 148 # ... and end at this offset ); print hexdump( "abcdefg", { output_format => '%4a : %C %S< %L> : %d' } ); DESCRIPTION"Data::Hexdumper" provides a simple way to format arbitrary binary data into a nice human-readable format, somewhat similar to the Unix 'hexdump' utility.It gives the programmer a considerable degree of flexibility in how the data is formatted, with sensible defaults. It is envisaged that it will primarily be of use for those wrestling alligators in the swamp of binary file formats, which is why it was written in the first place. SUBROUTINESThe following subroutines are exported by default, although this is deprecated and will be removed in some future version. Please pretend that you need to ask the module to export them to you.If you do assume that the module will always export them, then you may also assume that your code will break at some point after 1 Aug 2012. hexdumpDoes everything. Takes a hash of parameters, one of which is mandatory, the rest having sensible defaults if not specified. Available parameters are:
Note that 64-bit formats are *always* available, even if your perl is only 32-bit. Similarly, using < and > on the S and L formats always works, even if you're using a pre 5.10.0 perl. That's because this code doesn't use "pack()".
Alternatively, you can supply the parameters as a scalar chunk of data followed by an optional hashref of the other options: $results = hexdump($string); $results = hexdump( $string, { start_position => 100, end_position => 148 } ); SEE ALSOData::DumperData::HexDump if your needs are simple perldoc -f unpack perldoc -f pack INCOMPATIBLE CHANGES'number_format' is now implemented in terms of 'output_format'. Your data will be padded to a multiple of 16 bytes. Previously-silent code may now emit warnings.The mappings are: 'C' => ' %4a : %C %C %C %C %C %C %C %C %C %C %C %C %C %C %C %C : %d' 'S' => ' %4a : %S %S %S %S %S %S %S %S : %d' 'S<' => ' %4a : %S< %S< %S< %S< %S< %S< %S< %S< : %d' 'S>' => ' %4a : %S> %S> %S> %S> %S> %S> %S> %S> : %d' 'L' => ' %4a : %L %L %L %L : %d' 'L<' => ' %4a : %L< %L< %L< %L< : %d' 'L>' => ' %4a : %L> %L> %L> %L> : %d' 'Q' => ' %4a : %Q %Q : %d' 'Q<' => ' %4a : %Q< %Q< : %d' 'Q>' => ' %4a : %Q> %Q> : %d' and of course: 'V' => 'L<' 'N' => 'L>' 'v' => 'S<' 'n' => 'S>' BUGS/LIMITATIONSBehaviour of %a is not defined if your file is too big.Behaviour of %NNa is not defined if NN is too big for your sprintf implementation to handle 0x%0${NN}X. FEEDBACKI welcome constructive criticism and bug reports. Please report bugs either by email or via RT: <http://rt.cpan.org/Public/Dist/Display.html?Name=Data-Hexdumper>The best bug reports contain a test file that fails with the current code, and will pass once it has been fixed. The code repository is on Github: <git://github.com/DrHyde/perl-modules-Data-Hexdumper.git> AUTHOR, COPYRIGHT and LICENCECopyright 2001 - 2012 David Cantrell <david@cantrell.org.uk>This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively. CONSPIRACYThis module is also free-as-in-mason software.THANKS TO ...MHX, for reporting a bug when dumping a single byte of dataStefan Siegl, for reporting a bug when dumping an ASCII 0 Steffen Winkler, for inspiring me to use proper output formats
Visit the GSP FreeBSD Man Page Interface. |