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-dataD5/tmp/cpgfol +2_018356_00" "1400.cm1" atex-itf unix-filename "/atexdata/clspag-dataD5/furn-conten +t/header/bin/T_1400.cm1" "1476 .wr1" atex-itf unix-filename "/atexdata/clspag-dataD5/furn-conte +nt/header/bin/T_1476.wr1" "608373" eps unix-filename "/atexdata/clspag-dataD5/ad-content/71/1432 +671" .........(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


In reply to Parsing a multiline data structure by HamNRye

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.