While building a meta tag script everything was going fine until I decided to add some extra tests. Now I'm confused on how to print the HTML section and errors while doing multiple tests.

A chunk of code:

if ($char_keywords > 950) { print qq(<td><font color="red">Keywords: </font></td>); print qq(<td><font color="red">You had $char_keywords chars. +Max is 950.</font><br>); } else { print qq(<td>Keywords: </td>); }
Right now, it's only checking the char count. Simple enough. But now I want to also check the number of times each keyword was used. I already have this test setup but I don't know how I can combine both of these together.

It's an HTML form where if the data you input is invalid, the form is reloaded with the errors above text field which they "goofed". As you can see, when the char test fails it colors KEYWORDS red notifying you goofed. I can't add the repeating test inside the keyword test because they're two separate tests entirely. And I can't have them one after another because I can only print the word "kewords" once in red (I don't want to print the word twice if both tests fail).

Somehow these tests need to work together to only print out KEYWORDS in red once but yet both act as separate tests.

My brain hurts, any ideas on how to go about doing this?

The other test (which tests word repeats) is this:

foreach (keys %one_word_keywords) { my $key = $_; my $value = $one_word_keywords{$_}; if ($value > 6) { # this has to be printed in the normal table as well # but if this error happens AND the chars does # the word KEYWORDS would be colored red twice. print qq("$key" was repeated $value times. Max is 6<br><br>); } }


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

In reply to Multiple testing methods by sulfericacid

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.