http://qs321.pair.com?node_id=580513


in reply to Re: seeking in hash data structure
in thread seeking in hash data structure

There is Class::XPath, which allows you to graft XPath queries onto almost any class structure. Also, there is Data::Diver, which has its own query "language" to access elements without autovivification. Using a database incurs a lot of front-up work which may or may not pay off in the long run, as for every addition to the data format, the SQL schema needs to be modified. LDAP seems more suited for storing unstructured or semistructured hierarchical data.

Replies are listed 'Best First'.
Re^3: seeking in hash data structure
by jbert (Priest) on Oct 25, 2006 at 10:05 UTC
    Ah, I didn't know about Class::XPath. Looks very nice, and almost exactly what the doctor ordered.

    As far as I can see, Data::Diver doesn't allow the more general kind of querying which the OP requested.

    And whilst LDAP has a special place in my heart, as far as I know, it has the same schema issues which SQL does. LDAP object classes need to be defined in terms of mandatory and optional attributes, the attributes need to have an appropriate syntax. Basically LDAP object class == SQL table, LDAP attribute == SQL column. The main differences IMHO are that LDAP gives you a heirarchically-defined name for each entry and SQL gives you a richer query language.

    I would agree that DBs aren't the answer to everything, but they are an answer to "how do I do fairly arbitrary queries to my structuted data".