Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: CGI.pm Disillusionment

by Aragorn (Curate)
on Jun 05, 2003 at 14:40 UTC ( [id://263348]=note: print w/replies, xml ) Need Help??


in reply to CGI.pm Disillusionment

I don't use the HTML-generation functionality of the CGI.pm module for a simple reason: Separation of code and presentation of data. I try to design (web-)applications with the possibility that sometime in the future I may have to change the user-interface from a browser to, say, a Tk interface. Using a templating module (like Template Toolkit) which you only have to feed a reference to your data makes it much easier to replace the user-interface than grovelling through scripts and modules which have (possibly bad) HTML in them (and using the CGI HTML capabilities is the same as having plain HTML in your code, IMO).

So, apart from that it's probably much easier to maintain an application which uses a templating system, it also makes the design better by separating out the data and the means to display that data.

Arjen

Replies are listed 'Best First'.
Re: Re: CGI.pm Disillusionment
by one4k4 (Hermit) on Jun 05, 2003 at 18:09 UTC
    I too do not use CGI.pm nor Template::Toolkit, for seperation of code and presentation of data..

    I like to do things like:
    my @select_box_list; foreach (@some_array_containing_a_hashref){ push(@select_box_list,$html_obj->HTML_Select_List_Option(name=>" +select_your_state",value=$_->{whatever_value},text=>$_->{whatever_des +cription}); }
    That sort of thing.. wherein all html formatting subroutines are in a seperate module called HTML.pm or somesuch. For some reason I can do this quicker than I can with Template::Toolkit or CGI.pm.. Reinventing the wheel or not.

    One4k4 - perlmonks@poorheart.com (www.poorheart.com)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-23 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found