in reply to Re: Parameters not in order by using Config:Tiny
in thread Parameters not in order by using Config::Tiny

I think this requirement comes from the code in 1133314:

foreach $ini_sect ( keys %ini_file ) { %$ini_sect = %{ $ini_file{$ini_sect} }; }

This builds up a common structure from information distributed across different sections. I use a similar approach to have "common" and "specialized" sections:

[GENERAL] FOO=bar TEMPLATE=./templates/mytemplate-v3.html [until-20150409] TEMPLATE=./templates/mytemplate-v2.html [until-20150307] TEMPLATE=./templates/mytemplate-v1.html

Replies are listed 'Best First'.
Re^3: Parameters not in order by using Config:Tiny
by 1nickt (Canon) on Jul 06, 2015 at 15:02 UTC

    OK, so you have options for your options based on things, like maybe the date. I must be dense today, but I can't see how sorting would help unless you have cleverly named your sections (as in your example) and then do:

    my $template; while ( I am looping through Sections) { next unless first half of name is 'until'; next unless date in second half of name hasn't passed yet; $template = this_Section->{TEMPLATE}; last; }

    But for the OP, how would

    foreach $ini_sect ( sort keys %ini_file ) { %$ini_sect = %{ $ini_file{$ini_sect} }; }

    be any better than

    foreach $ini_sect ( keys %ini_file ) { %$ini_sect = %{ $ini_file{$ini_sect} }; }

    ??

    Remember: Ne dederis in spiritu molere illegitimi!

      Yeah, I assume that the OP has some "clever" sorting of their sections, and the last one in the file should win.

      My use case is to allow for "evolution" of the input and output while still being able to process and output files with the older formats, according to the report date.