Egan Ford wrote:

"This is a parser for simple name=value style Ini files. Soon it will also
handle files with sections."

Is there an update?

I'm attaching a couple of things I've got sitting around but that aren't ready for release yet that might help you. The first works like this:


  my $dbh = DBI->connect('dbi:AnyData(RaiseError=1):');
  my $AoH = [ { id=>1,phrase=>'foo' }
            , { id=>2,phrase=>'bar' }
            ];
  $dbh->ad_import('t','Hash',$AoH);
  print "ok!" if 'foo' eq $dbh->selectrow_array("
      SELECT phrase FROM t WHERE id=1
  ");

With some modification, it could automatically read a text file, use eval to turn it into a hash and import it, then on export use Data::Dumper to print it back to file.

The second attachment should parse and import Ini files with sections and even preserve comments within the Ini files.

Neither is ready for prime time. If you (or anyone else) wants to take on authorship of these, please do!

I am looking to maintain a dhcpd.conf type format with DBI.

It looks to me like dhcpd.conf format can include an unknown level of nesting so it's not a good candidate for importing into strict database table format. Also, it looks rather hairy, have those guys heard of YAML? :-) But if all you need to do is parse a subset of dhcpd rather than the whole syntax, my suggestions may help. Also if there's a dhcpd parser out there, it would be simple to write an AnyData::Format plugin that used the parser. If that's a direction you want to go and you need hints, let me know.


--
Jeff

Reply via email to