开发者

Should I write small CGI scripts or a big, monolithic script?

I am working on to create a web site to display some information about my system. This includes some graphs and some text information. For now I am creating different CGI scripts and calling them by creating links. A few days back one of my friends told me that instead of writting different CGI sc开发者_JAVA技巧ripts, it's better to write single CGI script and create functions to call the part of code. I am confused.

What do you prefer while creating a web site?


Writing a single CGI program is indeed better (slightly easier to reuse shared code) if you're not writing the dispatch code yourself. If you commit to go this way, use a framework. CGI-Application's concept of runmodes is basically the formalised concept of what your friend suggested, so this is a good choice for an advancing path.

Once you outgrow this system's limitations, have a look at Catalyst.


I tend to write separate scripts that share their commonality through libraries. If you're doing small things that simply show information, I think it's a waste of your time to learn a big framework.

However, if you are going to start interacting with your scripts, running queries, and so on, a framework might be attractive and worth the effort.

Look at the scripts you have now and see how much is similar in each. If you are doing the same infrastructure coding in all of them, you might benefit from moving them into a single script. If they don't really look the same or do the same thing, you're probably not going to get that much benefit in the extra work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜