Errors and Messages
One problem with CGI programs is figuring out where to display error and information messages. If this were a GUI-based program, you would use a pop-up window.
Pop-up windows are difficult in CGI programs. You need some Java or JavaScript code to display them. It’s bad enough having to deal with HTML and Perl without adding a new language to the mix, so pop-up windows are out.
If you are going to stick with a pure HTML/Perl solution, then the only output mechanism you have is the web page. You can either stick the messages on a page by themselves or add them to an existing page. The second way is the simpler and easier method, so that’s what’s done in the example. At the top of the display_form are a few lines that output ...
Get Perl for C Programmers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.