Tom Christiansen wrote: > Hey guys, > > My CPAN search-fu seems to be flagging, because I cannot find > something that surely must exist, and it seems a shame to > re-implement a perfectly functioning wheel if it already exists > and I just don't know about it. > > I wondered whether you knew of a somewhat generic, plug-in-able > frameworky class that allows you to read structured records from > files of various formats in a uniform fashion, and treat those > records the same way using some common interface. I'm betting > it must already exist, but I could find nothing on CPAN that > seemed at all like what I am thinking of. From what you described, I don't know something that versatile and pluggable. For text files, Augeas might be a solution for you. It's based on the theory of lenses, to accurately edit structured files. A lens describes the format in something vaguely looking like CAML (or so I've heard; I only know I didn't find it easy to write lenses). You then open files by specifying the format and you can read, edit and write them, always preserving their inner structure; accessing the fields via something similar to XPath. » http://augeas.net/ Their is a Perl binding, Config::Augeas » https://metacpan.org/module/Config::Augeas It's obviously very oriented for sysadmin tasks, but the engine and lenses can handle most kinds of structured text files. "Most" because the grammar engine is limited, although it has greatly improved over the years to handle, for example, Apache config format. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.Thread Previous | Thread Next