Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: CGI Benchmarks

by AgentM (Curate)
on Jan 24, 2001 at 09:00 UTC ( [id://53893]=note: print w/replies, xml ) Need Help??


in reply to Re: CGI Benchmarks
in thread CGI Benchmarks

Aaah! But you ARE missing out on something! Using the CGI tag shortcuts you don't have to write out the tags and the string is enclosed in Perl's parentheses rather than difficult to mind-parse tags (stay in Perl if you're using Perl ideology). Also, You'll be able to organize the HTML more clearly- including indentation (automatic for Perl and NOT for HTML in good editors), better spacing, and attribute clarity. Especially if you have long lines of attributes, you'll save yourself days of mind-boggling debugging if you use:
print HTMLtag({-attr1=>'bob', -attr2=>'Sammy Snake', ....}, 'Sammy Snake's Page');
rather than raw HTML. Table generation is also extremely useful in the CGI module, allowing you to logically group your attributes and indent them rather than arbitrary HTML spacing. If you read through the CGI docs, you'll also learn about a cool "design your own tag" which is easily created in the use CGI; line. That way, you can name an arbitrary new tag (which CGI may not support by default) with arbitrary attributes. In short, using CGI to its fullest can only result in beneficial and "easier-on-them-eyes" programming techniques. It definitely worth reading up on. M$ is mentioned in the tutorial. Btw, the syntaxes are to-the-point and rather obvious.
print TagWithNoAttrs('Howdy Ho Neighbor!'); print TagWithAttrs({-attr1=>'Blue',-attr2=>'orange'},'How many Preside +nts does it take to screw an intern?');
CGI also supports a method whereby you simply pass string arguments and thus implicitly print the attributes in a logical order without declaring what they are, but I tend towards the more explicit method. Have fun with CGI, though. That's what its main purpose is. (OK, so maybe that's arguable.)
AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.

Replies are listed 'Best First'.
Re: Re: Re: CGI Benchmarks
by ColonelPanic (Friar) on Jan 24, 2001 at 09:26 UTC
    You have a point there. The CGI.pm version does look a lot cleaner. For table generation, also, I would probably look into the module in more depth. However, I disagree with the point about debugging. I find that errors in printing the HTML are almost always readily visible. If an attribute isn't correct, you will instantly notice that that header isn't centered, or whatever. A simple view source will generally pinpoint the problem.

    When's the last time you used duct tape on a duct? --Larry Wall
      But using CGI, it's very unlikely that you'll have ANY broken tags. Anyway, you're right about the debugging. First, I would check what's wrong with the HTML source, THEN go to the perl and isolate the problem. Of course, if you can eliminate broken tags AND misspelled attributes, then you're debugging woes are kept to a minimum. CGI gives you the benefit of both.
      AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://53893]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found