Subject: | Feature Request - vertically align output |
Date: | Mon, 27 Feb 2012 10:48:20 -0800 (PST) |
To: | bug-confgi-std [...] rt.cpan.org |
From: | "Michael R" <michael [...] jamhome.us> |
Hi Guys!
I hope my squirrel mail web
interface doesn't screw up the formatting. Everything should be in a fixed
width font.
Given:
File: test.cfg (with vertically
aligned = )
[Lazy Meal Sources]
breakfast = cafeteria
lunch = restaurant
dinner = wonderful wife
[Non Lazy
Meal Sources]
breakfast = Steel cut oats
lunch = home packed in pail
dinner = shared cooking with wife
And test program t.pl:
#!/usr/bin/perl
use strict;
use
warnings;
use Config::Std;
my %meal_sources_config;
my
$cfg_file = "test.cfg";
read_config(
$cfg_file, %meal_sources_config );
$meal_sources_config{"Lazy
Meal Sources"}{"Brunch"} =
"Neighborhood Restaurant";
$meal_sources_config{"Non Lazy
Meal Sources"}{"Brunch"} = "New to us Restaurant";
write_config %meal_sources_config, $cfg_file;
test.cfg is
now:
[Lazy Meal Sources]
breakfast = cafeteria
lunch =
restaurant
dinner = wonderful wife
Brunch = Neighborhood
Restaurant
[Non Lazy Meal Sources]
breakfast = Steel cut oats
lunch = home packed in pail
dinner = shared cooking with wife
Brunch = New to us Restaurant
All that alignment is gone.
I understand with malignantly long keys this is problematic.
But for cases where all keys lengths are reasonable ( <20 ? ) it seems sane
for vertical alignment to be preserved. Perhaps by even capturing the original
indentation.
Rational of request:
Considering that
"This configuration language and parser was specifically designed using
the criteria suggested in this guideline (and elsewhere in this book)."
[PBP 1st Ed. p447] It would seem fitting for it to also adhere to the
guidelines presented elsewhere in the book.
Enough yak
washing, it's time for me to return to work. Thanks for the distraction.
--
Michael Rasmussen
Be Appropriate &&
Follow Your Curiosity