digger,

Apologies that I don't have time to completely review your code, but I noticed a few things upfront.

$end_chapter is initialized to 1 and always set to 1 by chapterize so that handleSeps will always get called on each line of input from the main loop.

In handleSeps $counter is initialized to zero and incremented only at %%BeginPageSetup, but in the same if clause if it hits 3, it is reset to 0. So, $counter never makes it past three, and handleSeps will only return at EOF.

Also, note that the first line of input (which is stored in $line) will never actually get printed to the output, as this only happens on the else clause of the main loop which is never hit.

Of course the real killer is the catch that <> only assigns to $_ in a while statement if it is the only thing inside the conditional. In the absence of that, and since $_ is not localized here, it will retain it's previous value -- The first line read from the file. This will be continously output (as $counter is not incremented) to your temp file.

If you are lucky enough that the first line of your input file contains %%BeginPageSetup or Output... then a slightly different string will be output to your temp file.

After that, the temp will grow as large as your filesystem permits (or until you hit ctrl-c)

Hope that helps....


In reply to Re: Can I do an "inner read"? by captain_haddock
in thread Can I do an "inner read"? by digger

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.