in reply to Re^2: Retaining hash order with Config::General?
in thread Retaining hash order with Config::General?

"Alphabetical is essentially random in this case, since anything except the structured order will not appear sane "

So use a label field and sort by that. Consider a database. I don't care how the database stores the internals, only that I can retrieve that data. If i want to sort that data, i have to make sure that the data is sortable in a meaningful way. Personally, i would not store information into a Config file that would be better suited in a database, such as data that changes often. YMMV.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^4: Retaining hash order with Config::General?
by Anonymous Monk on Dec 16, 2008 at 11:31 UTC

    I see your point(s). However this data doesn't change often, and is fairly complex (ie would involve a number of tables with one-to-many, m-to-o and o-to-o relationships. In short, a database solution would require signifficant development time as opposed to a few lines of Config::General creating a fully usable complex data structure that needs little or no maintenance and is simple to backup and modify.

    Second, what I need to retain here is only the order at which the keys were inserted. This works perfectly via the -Tie parameter when reading, just not when writing (see bart's post below).

    So by your database analogy, I need "SELECT * FROM tbl" -- no sorting or other magic, if I could simply keep the tie during save I'd be happy ;-)