in reply to Optional FONT tag

For a non-Perlish answer, have you looked at cascading style sheets? You could define a style for your "errored" boxes and it would automatically be applied. Much less reliance on HTML within your code.

I noticed that you are using a specific error message for first name blank. Something you may want to consider if you can have several errors of this type (first name blank, last name blank, etc.) is to set bits in your error collection routine instead of just a single return code, and then set up a generic routine for your output which checks the correct bit and puts in you-must-enter-this-red if it's flagged.

BTW, why are you setting the font a second time? With your current logic, shouldn't the second <FONT COLOR=FF0000> be </FONT> instead?

Good luck,
=Blue
...you might be eaten by a grue...

Replies are listed 'Best First'.
Using SPAN (Re: Re: Optional FONT tag)
by dws (Chancellor) on Jan 05, 2001 at 07:46 UTC
    The preferred way to avoid the <FONT> tag and take advantage of styles sheets is to use <SPAN>. And, as luck would have it, CGI.pm supports span (if you import the :html3 definitions).
    use CGI qw(:standard :html3); ... print span({-style => 'Color: red;'}, "I'm an error value!");
    Or, to do this with style sheets:
    use CGI qw(:standard :html3); ... print span({-class => 'Error'}, "I'm an error value!");
    I'll leave getting the style sheet defined as an open-book excercise. Reading the CGI.pm POD is allowed and encouraged.
Re: Re: Optional FONT tag
by t'mo (Pilgrim) on Jan 05, 2001 at 01:58 UTC

    Hear, hear! CSS is the way to go!

    (Seeing this reminded me that I need to update the "pet peeves section" of my home node)