in reply to Re: CGI and why?
in thread CGI and why?
use constant FOO => "BAR"; print << "BAZ" @{[ FOO ]} BAZ
I particularly enjoy this "poor man's templating" technique for very short CGI scripts where I don't want to load Template Toolkit II or some such, but still want to enjoy the benefits of separating application logic from display formatting. It can get tricky real quick like if you want to quote stuff inside the deref block though, so it doesn't scale very well. But that's okay - it keeps me from being falsely lazy when such a script happens to grow. :)
Of course, that's not real a solution for simple doublequotes, as
print "Hello, @{[ $q->param('real_name') ]}\n"; is of debatable beauty and a real pain to type out more than once or twice.Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^2: CGI and why?
by sauoq (Abbot) on Jan 01, 2003 at 06:10 UTC | |
by Aristotle (Chancellor) on Jan 01, 2003 at 13:53 UTC | |
by sauoq (Abbot) on Jan 01, 2003 at 22:01 UTC | |
by Aristotle (Chancellor) on Jan 01, 2003 at 22:12 UTC |