http://qs321.pair.com?node_id=45888

HamNRye has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I work for a newspaper and we are trying to generate a page report from our classified system. We plan to do this by parsing the "PIL" file that calls all of the elements for pagination.

I need to get all of the "object" sections out of a file, and they are multi-line sections.

The file starts with a line like so:

pageoutput-5.0.1.0:20001201,TD,*,*,,FOO,2; {

Then there is a section that defines the path to the EPS's that make up the section:

name-table { "DAILY.evo" atex-itf unix-filename "/atexdata/clspag-d +ataD5/tmp/cpgfol2_018356_00" "1400.cm1" atex-itf unix-filename "/atexdata/clspag-da +taD5/furn-content/header/bin/T_1400.cm1" "1476 .wr1" atex-itf unix-filename "/atexdata/clspag-d +ataD5/furn-content/header/bin/T_1476.wr1" "608373" eps unix-filename "/atexdata/clspag-dataD5/ad +-content/71/1432671" .........(etc.)

Next section sets up the page dims:

canvas { user-name "ATEX-CLSPAG:20001201,TD,*,*,,F,2,WHEELS,2;" + units 35278 dimensions { 9360 15241 } application { app-name "ATEX-REFLEX" string { last-modified-time " +20001203:14:24:46" } string { status "UNDEFINED" } } }
And the we have "object" sections for each element:
object { origin { 0 0 } dimensions { 9360 130 } id "DAILY.evo" user-name "DAILY.evo" rc-name "DAILY.evo" application { app-name "ATEX-FPO-DUMMY-CONTROL" string { major-type "FRN" } string { ad-number "DAILY.evo +" } } } object { origin { 0 130 } dimensions { 900 1 } id "1400.cm1" user-name "1400.cm1" rc-name "1400.cm1" application { app-name "ATEX-FPO-DUMMY-CONTROL" string { major-type "FRN" } string { ad-number "1400.cm1" + } } }
And these repeat for each ad on the page. How would I get each of these object sections?? I would like to store them in a hash called %object and key them by the "id" field in the object section. I also will need to store the object origin and dimension.
example: %object{1400.cm1;originw} ; # References Origin Width for 1400.cm1
I know this must seem simple to many of you, but I don't really understand stepping through a file and getting this all out. Thanks for any help. (Didn't see this in TFM, but i might just not know where to look...) ~HamNRye