sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
A chunk of code:
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.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>); }
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>); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multiple testing methods
by JediWizard (Deacon) on Sep 26, 2004 at 19:18 UTC | |
by BigLug (Chaplain) on Sep 26, 2004 at 21:37 UTC | |
|
Re: Multiple testing methods
by pg (Canon) on Sep 26, 2004 at 18:59 UTC | |
by sulfericacid (Deacon) on Sep 26, 2004 at 19:04 UTC | |
|
CGI::QuickForm might be a nice option
by dazzle (Sexton) on Sep 26, 2004 at 23:33 UTC |