Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

(jeffa) Re: CGI versus CGI::* modules

by jeffa (Bishop)
on Jul 31, 2003 at 21:11 UTC ( #279796=note: print w/replies, xml ) Need Help??

in reply to CGI versus CGI::* modules

That huge project wouldn't happen to be XINA, would it? ;) I just took a look at some of your source code and see that you use a number of different HTML generation styles: functional, object oriented, here docs, and plain old strings. I know this is a lot to ask, but why not branch off a new version that uses a full blown templating system instead? I recommend HTML::Template because it is not too large, fast, and has no non-core module dependencies.

Note that while you need to take many steps backwards, your new code will be free of embedded HTML, allowing you to concentrate on logic only. You might even be able to completely deprecate xistlyesheeteditor.cgi, for example, because your users will instead be able to supply their own (unless you are holding their hand because they can't write CSS).

Personally, i think XINA is cool, but it could use a serious re-write. There is a lot of repeated functionality in every cgi script that should be abstracted into a module instead (meta data collection, database connection, etc). Also, i notice that you only allow connections to MySQL and PostreSQL databases. If you instead allow the user to specify any DBD module, then maybe other programmers will be willing to port XINA to work with those databases for you. ;) Keep your code modular and marvel at the input of others.

For the record, i still love - but i only use it in conjunction with HTML::Template for any serious production code that i produce. Once i made the "clean break" to templates, managing web apps became a lot easier. (CGI::Application might server XINA well, by the way.) Best of luck to you and XINA. :)


(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) Re: CGI versus CGI::* modules
by michellem (Friar) on Jul 31, 2003 at 23:56 UTC

    I agree with everything you've said. It does need a serious re-write, I'm a pretty lame coder, and as with most open source projects, the challenge is finding the time to do that. Much of the code is evolutionary. Up until now, I've been busy putting in features that pay the bills, and have only had bits of time to do under-the-hood work, and I also only recently have a second developer on the team (more is welcome!). I'm doing a fair bit of extracting functionality and putting them into modules this summer, so version 0.6.2 or whatever I come out with next will have a number of modules, instead of many of those repeated functions, etc.

    One of the strategies I have been thinking of is using templating. XINA now uses templating to some degree, but it's hand-rolled and clunky (to say the least.) I'm trying to find ways to both make it easy for me to use templates, as well as end-users, without too much hassle.

    Thanks for the suggestions!
Re: (jeffa) Re: CGI versus CGI::* modules
by Willard B. Trophy (Hermit) on Aug 01, 2003 at 13:43 UTC
    My only complaint about HTML::Template is that its templates break validators/reformatters such as HTML Tidy.

    Nothing would make me happier than to be proved wrong on this, though ...
    (yeah, I'm an old SGML type. Things that don't validate worry me.)

    Update, Aug 5: In an attempt to prevent further XP slide, I have to admit that I hadn't RTFM quite thoroughly enough before posting. In addition to the method given by mbadolato below, there's also the vanguard_compatibility_mode option, which allows you to code simple variables as %NAME%.

    bowling trophy thieves, die!

      If you put your template tags in as <!-- TMPL_VAR NAME="foo" --> instead of <TMPL_VAR NAME="foo" > then you shouldn't have any issue with validators or html tidy, I would think. Is that not the case?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2021-05-14 01:23 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (146 votes). Check out past polls.