RE: [code-review] list scope

Paul Hoffman <[email protected]> Mon, 15 Sep 2003 10:01:53 -0400
Newsgroups gmane.comp.lang.perl.code-review-ladder
Message-ID <[email protected]>
On Friday, September 12, 2003, at 05:17:06 -0400, 
[email protected] wrote:

> It's a bit of work to split your process into a parse and dump phase,
> followed by an undump and analyse phase but if you end up reanalysing 
> even
> once, it sounds like you'll get that time back pretty quickly.

This is a bit OT, but maybe it'll help someone...

In a recent project, I used YAML to load and dump intermediate files 
(basically, at the beginning and end of each make target).  My program 
combines data from three files, each in a different format, and 
produces two different reports with different contents.  I don't 
recommend YAML::LoadFile for 1GB files! -- even for 2MB files it was 
annoyingly slow -- *but* it saved my bacon more than once by letting me 
see what the data looked like each step of the way; when I saw puzzling 
output, I was able to pin down my coding logic flaws quickly and easily 
because the intermediate files were there (and were so easy to read).

And you can't get much simpler than this:

   use YAML ();
   $data = YAML::LoadFile('foo.yml');
   ... do something with $data ...
   YAML::DumpFile('bar.yml', $data);

Paul.

--
Paul Hoffman :: Taubman Medical Library :: Univ. of Michigan
[email protected] :: [email protected] :: http://www.nkuitse.com/