in reply to losing html in print calling function.

I am sorry for my poor understanding of your problem. If you allow me to ask...

we lose the html from the calling print lines in the output, but not the text

What does it mean your "losing html"? I guess you mean html as "if/else" block's img tags, but I couldn't understand where it is when I saw "apple"'s output with my browser. "not the text" means you don't care if print "$record" prints nothing?

  • Comment on Re: losing html in print calling function.

Replies are listed 'Best First'.
Re^2: losing html in print calling function.
by Librum (Initiate) on Nov 21, 2011 at 16:10 UTC

    Remiah,

    I knew that was clumsy, let me try again.

    this is one of the calling print lines.

    if (open(THE_FILE, $prestring . "WWM.txt")){print "<center><img border +=0 src=/article_separator.png><br><B>WWM: Windmills and Wind Motors. +1910.</B></center><br>";fn1();} else {print "<center><img border=0 sr +c=/article_separator.png><br><b>Windmills and Wind Motors, 1910,</b> +has no ATOCI.</b></center><br>"};

    In the output, it does not render the center, the img, the line break, the bold. It does render the "WWM: Windmills and Wind Motors. 1910". Then no render of the nobold, the nocenter, the line break. It does render from the function print line html tags.

    Back to testing... And thanks for responding.

      It does seem a strange bug. Have you checked the value of $prestring? I would not suspect fn1 in this case.

      I took another look at your page and checked the source again.

      Where a list of results occurs, e.g search for apple and look at the data found in "FCOA: Farmers Cyclopedia of Agriculture. 1911"; there is malformed HTML

      <center><img border=0 src=/article_separator.png><br><B>FCOA: Farmers +Cyclopedia of Agriculture. 1911.</b></center><br><center><TR><td>APPL +E&#65533;Root-grafting, root vs. top-grafting, location and soil, pla +nting the trees, cultivation and cover crops, manuring, pruning, harv +esting and storage, utilization of waste apples, varieties, general s +cheme for spraying apple trees, enemies</td><td> 216</td></tr> <br><center><TR><td>PINEAPPLE&#65533;Locations, propagation, fertilize +rs, growing under sheds, varieties, enemies</td><td> 287</td></tr> <br><center>Apples, 216<Br> <br><center>Apples, Aphis, 228<Br> <br><center>Apples, Bitter Rot, 223<Br> <br><center>Apples, Borers, 226, 270<Br> <br><center>Apples, Brown Rot, 224, 275<Br> <br><center>Apples, Bud Moth, 227<Br>Rot, 223<Br>

      with some table markup being thrown in and no closing center tag on the record data returned from the file.

      Your initial file title is there

      <center><img border=0 src=/article_separator.png><br><B>FCOA: Farmers +Cyclopedia of Agriculture. 1911.</b></center><br>

      but I would assume the sudden appearance of table markup followed by unterminated center tags isn't helping your output. In this case I would say the error is probably in your original fn1 function where you print the record out and the table markup is in the data you pick up. Neither of these is a Perl problem although they can be solved with Perl

      If I haven't identified your problem, would you please post a snippet of HTML that shows the problem?