|Syntactic Confectionery Delight|
Anyone for UIEE?by Cody Fendant (Friar)
|on Aug 30, 2010 at 23:32 UTC||Need Help??|
Cody Fendant has asked for the
wisdom of the Perl Monks concerning the following question:
I recently had to write code to parse files in UIEE format. Have any monks come across it before?
There isn't anything on CPAN which I could find, although there were some plaintive, unanswered cries for help out there on sites like Experts Exchange. It's a rather old-fashioned format, but still used in the book trade. Some booksellers use it to upload their inventories to Amazon, I believe.
Parsing an actual file is incredibly simple, I did it roughly like this:
Though that doesn't deal with the issue of binary data, or of course error handling and so on.
Does anyone think a CPAN module would be a good idea? To me it's in a grey area where anyone halfway competent with perl would be able to knock up a script like mine in five minutes, and anyone who wasn't able to do that would have bigger problems than not having a module.
One other problem I encountered was that the UIEE files I was dealing with didn't actually follow the spec anyway, and I couldn't rely on things like field order which should indicate validity. If there's lots of invalid code out there, people will have to write their own parsers a lot of the time anyway.