CONFIG_DATA(1p)
π CONFIG_DATA(1p) π
okay bestie, so this is config_data, a little script from the Perl user-contributed docs. it's here to Query or change configuration of Perl modules. yes really. it's giving tiny-tool-big-energy. let's go π
β¨ SYNOPSIS β¨
# Get config/feature values
config_data --module Foo::Bar --feature bazzable
config_data --module Foo::Bar --config magic_number
# Set config/feature values
config_data --module Foo::Bar --set_feature bazzable=1
config_data --module Foo::Bar --set_config magic_number=42
# Print a usage message
config_data --help
like. look at that. four lines and she already ate π₯
πΈ DESCRIPTION πΈ
so the config_data tool is a command-line interface to the configuration of Perl modules. and when we say "configuration" we mean the vibe of "user preferences" or "local settings" β you know, the stuff you tweak and then forget you tweaked. this whole thing is a formalization and abstraction of the systems that people like Andreas Koenig (CPAN::Config), Jon Swartz (HTML::Mason::Config), Andy Wardley (Template::Config), and Larry Wall (perl's own Config.pm) have developed independently. legends, honestly π«Ά
the configuration system employed here was developed in the context of Module::Build. under this system, configuration information for a module Foo, for example, is stored in a module called Foo::ConfigData) (I would have called it Foo::Config, but that was taken by all those other systems mentioned in the previous paragraph...). and yes, that parenthesis situation is exactly as the original page says it, no notes π
these ...::ConfigData modules contain the configuration data, as well as publicly accessible methods for querying and setting (yes, actually re-writing) the configuration data. the config_data script (whose docs you are currently reading, hi, you're doing it) is merely a front-end for those methods. if you wish, you may create alternate front-ends. main character behavior β¨
the two types of data that may be stored are called "config" values and "feature" values.
- a "config" value may be any perl scalar, including references to complex data structures. it must, however, be serializable using
Data::Dumper. no exceptions bestie, that's the rule π - a "feature" is a boolean (
1or0) value.
π USAGE π
this script functions as a basic getter/setter wrapper around the configuration of a single module. on the command line, specify which module's configuration you're interested in, and pass options to get or set config or feature values. the following options are supported:
--moduleβ Specifies the name of the module to configure (required). no module, no service, periodt.--featureβ When passed the name of afeature, shows its value. the value will be1if the feature is enabled,0if the feature is not enabled, or empty if the feature is unknown. When no feature name is supplied, the names and values of all known features will be shown. all of them. the whole roster π--configβ When passed the name of aconfigentry, shows its value. the value will be displayed usingData::Dumper(or similar) as perl code. When no config name is supplied, the names and values of all known config entries will be shown.--set_featureβ Sets the givenfeatureto the given boolean value. Specify the value as either1or0. that's it. binary. slay π--set_configβ Sets the givenconfigentry to the given value.--evalβ If the--evaloption is used, the values inset_configwill be evaluated as perl code before being stored. this allows moderately complicated data structures to be stored. for really complicated structures, you probably shouldn't use this command-line interface β just use the Perl API instead. take the hint bestie π--helpβ Prints a help message, including a few examples, and exits.
lowkey reminder:--moduleis required, and--set_featureonly accepts1or0. don't be out here inventing new booleans π
π AUTHOR π
Ken Williams, kwilliams@cpan.org
π COPYRIGHT π
Copyright (c) 1999, Ken Williams. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π SEE ALSO π
and that's the whole page, bestie! π this one's from perl v5.40.1, dated 2025-04-13 β so go forth, query your configs, set your features, and remember: Foo::ConfigData) will always be there for you. iykyk π¦β¨
π¦ where this page comes from
- debian trixie: libmodule-build-perl 0.423400-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmodule-build-perl 0.423400-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmodule-build-perl 0.423400-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms