in reply to CGI.pm HTML shortcuts

What are your goals? If you are writing stuff on your own, for your own use, that won't change very often, then sure... use CGI. If you want it to be more maintainable, to separate content from function, then you should really should move the content out of the cgi. That is move the html into separate files.

There are many ways to do this, but this allows you to modify the html without introducing errors into your cgi. Beyond this, imagine you hire somebody to do the graphic design for you, you can hand them ugly HTML, and they can make it look as pretty as you like.

To go a step further, you might consider a templating system that allows for overriding content. This would allow you to use your same cgi's in another language or would allow you to let users choose colors or format.

So, what would you like. In the long run, I think you would be happier with separate content files that can have their own revision history.

Replies are listed 'Best First'.
Re: Re: CGI.pm HTML shortcuts
by brpsss (Sexton) on Apr 19, 2001 at 23:27 UTC

    Yes, EXACTLY!! Hiring a web designer is what I wanted to do.. but I was sure they wouldn't like the nasty $ signs in the HTML code..

    Thanks for the suggestion about templates.. for the moment, this is more or less for myself, I am the only person writing this.. but the team is expected to grow larger soon, and separating the HTML information is something that I would like to do when I finish work completely on the CGI portion...

      We've done it here for a long time. We have 500,000 to 1 million cgi hits a day. All of them pull the content in from external files that is overridable depending upon which host you are on.

      As for the $ signs. Our html guys haven't cared about it. However, I would suggest using something with a beginning and end delimeter such as __variable__, or ^variable^, rather than $variable. Using beginning and end delimeters avoids the problem of swapping $20.00 or putting a variable inside of \w text (try to swap out ABCDEFG$variableHIJK).

      Even if it is a small operation, having the code external will save you time in the long run.