Rebased patch. No changes except that merge conflicts were resolved,and I had to add some Data::Dumper tweaks to the regression tests sothat the results came out in consistent order on different versions ofPerl.