NAME

Debug::StrDump - Provides a byte representation of a string.

SYNOPSIS

  use Debug::StrDump;
  my $str = "This is a test string to be dumped with StrDump.";
  $str .= "\nHere are some control characters: \a\r\n\0";
  str_dump ($str);
  

DESCRIPTION

Debug::StrDump dumps a string into an array of bytes, similar to what you see in a stack dump. The string printed is formatted like this.

 54  68  69  73  20  69  73  This is
 20  61  20  74  65  73  74  a test

(Without monospaced formatting, this may look different)

By default, this function dumps the text as a hex string, but this is changable to decimal format

FUNCTIONS

str_dump

The main function used to dump a string. The function dumps to the filehandle currently selected.

use_hex

Changes the current dump format to hex. Returns undef if hex is already selected.

use_dec

Changes the current dump format to decimal. Returns undef if decimal is already selected.

dump_format

Returns either 'hex' or 'dec' depending on what dump format is selected.

EXPORT

str_dump

TODO

Add octal, sexagesimal, and floating-point representations of numbers.

AUTHOR

KScript, <lt>kscript@inbox.com<gt>

COPYRIGHT AND LICENSE

 Copyright (c) 2007, Noah Rankins
 All rights reserved
 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

     1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
     2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.
     3. Neither the name of Noah Rankins nor the names of its contributors may be used to endorse or promote products derived from this softwarewithout specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY NOAH RANKINS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NOAH RANKINS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.