R
Rainer Weikusat
I'm currently forced to use/ write some non-entirely-trivial Javascript
code for the first time in my life. This code is going to be mostly
static with a few (one or two) parameters interpolated into it. And I
need to use it in the context of more than one 'generated web
page'. Because of this, I'm using a dedicated CGI script to write this
code and presently, the relevant section looks like this (trivial early
example because I'm not really familiar with the language and need to
'find a way through it' first):
print("Content-Type: text/javascript\n\n");
printf(<<TT, $name);
function showName()
{
alert('%s')
setTimeout(showName, 5000)
}
setTimeout(showName, 5000)
TT
Something like this was posted as supposedly deterrent example here a
while ago. In contrast to that, I think this is really an example of a
here-document coming in extremely handy because I can just put the
alien code into the Perl-script without it tripping up my editor and
without using a strangely-formatted printf-statement.
code for the first time in my life. This code is going to be mostly
static with a few (one or two) parameters interpolated into it. And I
need to use it in the context of more than one 'generated web
page'. Because of this, I'm using a dedicated CGI script to write this
code and presently, the relevant section looks like this (trivial early
example because I'm not really familiar with the language and need to
'find a way through it' first):
print("Content-Type: text/javascript\n\n");
printf(<<TT, $name);
function showName()
{
alert('%s')
setTimeout(showName, 5000)
}
setTimeout(showName, 5000)
TT
Something like this was posted as supposedly deterrent example here a
while ago. In contrast to that, I think this is really an example of a
here-document coming in extremely handy because I can just put the
alien code into the Perl-script without it tripping up my editor and
without using a strangely-formatted printf-statement.