here documents

Discussion in 'Perl Misc' started by Rainer Weikusat, Apr 3, 2014.

  1. 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.
     
    Rainer Weikusat, Apr 3, 2014
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. calmar
    Replies:
    6
    Views:
    480
    Nick Craig-Wood
    Nov 15, 2004
  2. Jim Hill

    Easy "here documents" ??

    Jim Hill, Dec 19, 2004, in forum: Python
    Replies:
    33
    Views:
    1,243
    Jim Hill
    Dec 22, 2004
  3. Replies:
    1
    Views:
    520
    Juan T. Llibre
    Oct 18, 2006
  4. Douglas Wells
    Replies:
    8
    Views:
    166
    Nobuyoshi Nakada
    Jan 27, 2007
  5. Roger Pack

    array of here documents

    Roger Pack, Feb 8, 2008, in forum: Ruby
    Replies:
    6
    Views:
    118
    Xavier Noria
    Feb 9, 2008
Loading...

Share This Page