--- Octavian Rasnita <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a question about using CGI.pm. > > How it is better? To print directly the html code with > print "<html> <head> <title> ...</title> </head>"; etc. or > > to print using the CGI.pm > print $q-> start_html(...); etc. > Does it work faster in a way or another, or are there any advantages? > I saw that some things can't be made using CGI.pm. > > Thanks. > Teddy,
Many people view this as a matter of personal taste. The CGI.pm methods are going to be slower, but do have some advantages: 1. Newer versions produce valid XHTML. 2. It's tough to forget to close a tag. 3. It's tough to misnest tags. 4. Your HTML may not do what you want, but it will probably be valid in form. 5. When creating forms, they are automatically "sticky" (send the user back to the form and the form values are often filled in for you). Many people prefer printing the HTML because they think it's cleaner and they already know HTML. Unless you're doing a simple script, however, going with a proper template system such as Template Toolkit or HTML::Template is usually a better way to go. Cheers, Curtis "Ovid" Poe ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]