Data::P...::Config(3)
π NAME π
Hey bestie, welcome to the Data::P...::Config(3) page from User Contributed Perl Documentation π This one is about Data::Printer::Config β it loads run-control (.dataprinter) files for Data::Printer. Periodt. β¨
πΈ DESCRIPTION πΈ
So, Data::Printer::Config is used internally to load .dataprinter files. That's the whole vibe: it's the behind-the-scenes config loader, not the main-character module you're supposed to call directly. π«Ά
π¦ THE RC FILE π¦
Okay so the RC file is the .dataprinter situation, and here's the whole example with every little detail. Study it, copy it, love it:
# line comments are ok with "#" or ";"
; this is also a full line comment.
; Comments at the end of a line (inline) are not allowed
multiline = 0
hash_max = 5
array_max = 5
string_max = 50
# use quotes if you need spaces to be significant:
hash_separator = " => "
class.show_methods = none
class.internals = 0
filters = DB, Web
# if you tag a class, those settings will override your basic ones
# whenever you call p() inside that class.
[MyApp::Some::Class]
multiline = 1
show_tainted: 1
class.format_inheritance = lines
filters = MyAwesomeDebugFilter
[Other::Class]
theme = Monokai
; use "begin filter NAME" and "end filter" to add custom filter code.
; it will expose $obj (the data structure to be parsed) and $ddp
; (data printer's object). YOU MAY ONLY DO THIS IF YOUR FILE IS ONLY
; READABLE AND WRITEABLE BY THE USER (i.e. chmod 0600).
begin filter HTTP::Request
return $ddp->maybe_colorize($obj->method . ' ' . $obj->uri, 'string')
. $obj->decoded_content;
end filter
Quick vibe check on that RC file: # and ; both start full-line comments, but inline comments at the end of a line? Nope, not allowed. Quoting matters if you need spaces to be significant. Class tags like [MyApp::Some::Class] and [Other::Class] let those settings override your basic ones whenever you call p() inside that class. And begin filter NAME / end filter adds custom filter code β it exposes $obj (the data structure to be parsed) and $ddp (data printer's object). π
β οΈ Big warning, bestie: you may ONLY do thebegin filter/end filtercustom filter thing if your file is ONLY readable and writeable by the user (i.e.chmod 0600). Like, literally do not skip that. π
π₯ PUBLIC INTERFACE π₯
This module is not meant for public use. However, because Data::Printer changed the format of the configuration file, we provide the following public function for people to use:
β¨ convert( $filename ) β¨
perl -MDDP -E 'say Data::Printer::Config::convert( q(/path/to/my/.dataprinter) )'
Loads a deprecated (pre-1.0) configuration file and returns a string with a (hopefully) converted version, which you can use for newer (post-1.0) versions. Slay. π
Other public functions, not really meant for general consumption, are:
load_rc_file( $filename )β loads a configuration file and returns the associated data structure. If no filename is provided, it looks for.dataprinter.
π SEE ALSO π
Data::Printer
That's the whole page, bestie. Signed off by perl v5.42.0, dated 2024-01-23, and filed under Data::P...::Config(3). πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Data-Printer 1.002001-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms