Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Data::Printer::Filter:UsertContributed PeData::Printer::Filter::ContentType(3)

NAME
       Data::Printer::Filter::ContentType - detect popular (binary) content in
       strings

SYNOPSIS
       In your ".dataprinter" file:

	   filters = ContentType

       You may also customize the look and feel	with the following options
       (defaults shown):

	   filter_contenttype.show_size	= 1
	   filter_contenttype.size_unit	= auto

	   # play around with these if you want	to print the binary content:
	   filter_contenttype.hexdump	     = 0
	   filter_contenttype.hexdump_size   = 0
	   filter_contenttype.hexdump_offset = 0
	   filter_contenttype.hexdump_indent = 0

	   # you can even customize your themes:
	   colors.filter_contenttype	     = #ca88dd
	   colors.filter_contenttype_hexdump = #ffcb68

       That's it!

DESCRIPTION
       This is a filter	plugin for Data::Printer that looks for	binary strings
       with signatures from popular file types.	If one is detected, instead of
       the bogus binary	dump it	will print the content type and	the string
       size.

       For example, let's say you've read an image file	into $data, maybe from
       a user upload or	from Imager or ImageMagick. If you use Data::Printer
       with this filter, it will show you something like this:

	   my $data = get_image_content_from_somewhere();

	   use DDP; p $data;   # (PNG Image, 32K)

   hexdump
       If, for whatever	reason,	you want to inspect the	actual content of the
       binary data, you	may set	"filter_contenttype.hexdump" to	true. This
       will pretty-print your data in hexadecimal, similar to tools like
       "hexdump". Once active, it will print the entire	content, but you may
       limit the size by changing "filter_contenttype.hexdump_size" to any
       value (unit == bytes), and you can even start from a different position
       using "filter_contenttype.hexdump_offset". Set it to a negative value
       to make your offset relative to the end to the data.

       Finally,	the default hexdump mode will not indent your content. Since
       it's a binary dump, we want to get as much terminal space as we can. If
       you rather have the dump	properly indented (relative to your current
       dump indentation	level),	just set "filter_contenttype.hexdump_indent"
       to 1.

   Detected Content
       Below are the signatures	detected by this filter.

       Images

       o   PNG

       o   JPEG

       o   GIF

       o   ICO

       o   TIFF

       o   BMP

       Video

       o   AVI

       o   MPEG

       Audio

       o   WAV

       o   MP3

       o   FLAC

       o   OGG

       Documents and Archives

       o   ZIP

       o   GZIP

       o   BZIP2

       o   PDF

       o   Binary Executables (ELF and Win32)

       We don't	want this list to grow into a full-blown detection system, and
       instead just focus on common types. So if you want to contribute	with
       patches or open an issue	for a missing type, please make	sure you
       actually	have data structures with that content (e.g. you were bit by
       this in your code and DDP didn't	help).

       We want to help people debug code, not add content types	just for the
       sake of it :)

SEE ALSO
       Data::Printer

perl v5.32.1			  2021-01Data::Printer::Filter::ContentType(3)

NAME | SYNOPSIS | DESCRIPTION | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Data::Printer::Filter::ContentType&sektion=3&manpath=FreeBSD+13.1-RELEASE+and+Ports>

home | help