1Data::Printer::Filter::UCsoenrteCnotnTtyrpieb(u3t)ed PerDlatDao:c:uPmreinnttaetri:o:nFilter::ContentType(3)
2
3
4

NAME

6       Data::Printer::Filter::ContentType - detect popular (binary) content in
7       strings
8

SYNOPSIS

10       In your ".dataprinter" file:
11
12           filters = ContentType
13
14       You may also customize the look and feel with the following options
15       (defaults shown):
16
17           filter_contenttype.show_size = 1
18           filter_contenttype.size_unit = auto
19
20           # play around with these if you want to print the binary content:
21           filter_contenttype.hexdump        = 0
22           filter_contenttype.hexdump_size   = 0
23           filter_contenttype.hexdump_offset = 0
24           filter_contenttype.hexdump_indent = 0
25
26           # you can even customize your themes:
27           colors.filter_contenttype         = #ca88dd
28           colors.filter_contenttype_hexdump = #ffcb68
29
30       That's it!
31

DESCRIPTION

33       This is a filter plugin for Data::Printer that looks for binary strings
34       with signatures from popular file types. If one is detected, instead of
35       the bogus binary dump it will print the content type and the string
36       size.
37
38       For example, let's say you've read an image file into $data, maybe from
39       a user upload or from Imager or ImageMagick. If you use Data::Printer
40       with this filter, it will show you something like this:
41
42           my $data = get_image_content_from_somewhere();
43
44           use DDP; p $data;   # (PNG Image, 32K)
45
46   hexdump
47       If, for whatever reason, you want to inspect the actual content of the
48       binary data, you may set "filter_contenttype.hexdump" to true. This
49       will pretty-print your data in hexadecimal, similar to tools like
50       "hexdump". Once active, it will print the entire content, but you may
51       limit the size by changing "filter_contenttype.hexdump_size" to any
52       value (unit == bytes), and you can even start from a different position
53       using "filter_contenttype.hexdump_offset". Set it to a negative value
54       to make your offset relative to the end to the data.
55
56       Finally, the default hexdump mode will not indent your content. Since
57       it's a binary dump, we want to get as much terminal space as we can. If
58       you rather have the dump properly indented (relative to your current
59       dump indentation level), just set "filter_contenttype.hexdump_indent"
60       to 1.
61
62   Detected Content
63       Below are the signatures detected by this filter.
64
65       Images
66
67       •   PNG
68
69       •   JPEG
70
71       •   GIF
72
73       •   ICO
74
75       •   TIFF
76
77       •   BMP
78
79       Video
80
81       •   AVI
82
83       •   MPEG
84
85       Audio
86
87       •   WAV
88
89       •   MP3
90
91       •   FLAC
92
93       •   OGG
94
95       Documents and Archives
96
97       •   ZIP
98
99       •   GZIP
100
101       •   BZIP2
102
103       •   PDF
104
105       •   Binary Executables (ELF and Win32)
106
107       We don't want this list to grow into a full-blown detection system, and
108       instead just focus on common types. So if you want to contribute with
109       patches or open an issue for a missing type, please make sure you
110       actually have data structures with that content (e.g. you were bit by
111       this in your code and DDP didn't help).
112
113       We want to help people debug code, not add content types just for the
114       sake of it :)
115

SEE ALSO

117       Data::Printer
118
119
120
121perl v5.36.0                      2022-08-D0a1ta::Printer::Filter::ContentType(3)
Impressum