in reply to Re: CGI problem: trying to assign parameters in a loop
in thread CGI problem: trying to assign parameters in a loop

Sigh.

Yes, templating is a nice solution to a number of problems, and can really clarify your code. But keep in mind it is not always bad. Sometimes a quick-and-dirty solution is easier. Many people like Perl because it enables you to do things that would otherwise take hours to do.

Maybe you're right about this script. Maybe _this_script_ should use a templating solution. Add "in most cases", "in this case" or something like that and you're right.

Keep in mind: TIMTOWTDI, and some ways TDI are better than others, but that doesn't mean the worse ways should be avoided completely.

2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Replies are listed 'Best First'.
Re: Re: Re: CGI problem: trying to assign parameters in a loop
by gav^ (Curate) on Jan 20, 2002 at 00:04 UTC

    If it is not a throw away script then you need to attempt at least some good programming practices.

    In my experiance I've found that too many simple hacked together CGI scripts stay in production because a) they work and b) nobody has the time/money to fix them. The problem is that 6 months down the line somebody normally has to make a small change, which turns out to be another hack and so on and so forth.

    Sometime you have to sit down and say, lets make this work properly and do it in a way that allows simple maintanance.

    I have a big problem with embedded HTML in CGI scripts, I might be the one that has to maintain it and then I've got to spend ages trying to work out how it works.

    Plus in his code he used the normal perl quoting which means he has to remember to put a \ in front of each quote which is a royal pain in the arse.

    What's wrong with:

    use File::Basename; $foo = basename($bar);
    It's a hell of a lot more obvious what this does than your rexexp.

    gav^