in reply to Contextual find and replace large config file
"Does anyone know of a better or more generic way to do these kind of things?"
There's lots of choices for config files. JSON and YAML are popular. Your second example is pretty close to JSON already. It would look like this as JSON:
{ "ObjectType1": { "Param1": 8, "Param2": "SomeText", "NestedObject": { "Param1": 3, "Param2": "SomeText" } }, "ObjectType2": { "Param1": 10 } }
There are perl modules to parse JSON, some streaming, if you really can't load it all into memory. There's also a really nice command line utility called "jq", see some examples here.
Note that JSON doesn't support comments, which is probably the biggest complaint about it as a configuration file format.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Contextual find and replace large config file
by LanX (Saint) on Jan 03, 2019 at 23:09 UTC | |
Re^2: Contextual find and replace large config file
by karlgoethebier (Abbot) on Jan 03, 2019 at 17:23 UTC | |
by choroba (Cardinal) on Jan 03, 2019 at 17:41 UTC | |
by karlgoethebier (Abbot) on Jan 04, 2019 at 14:36 UTC |
In Section
Seekers of Perl Wisdom