[32301] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3568 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 15 09:09:18 2011

Date: Thu, 15 Dec 2011 06:09:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 15 Dec 2011     Volume: 11 Number: 3568

Today's topics:
    Re: Question on using perl in a cgi script <cartercc@gmail.com>
    Re: vi regex to preserve interior commas in CSV string <cartercc@gmail.com>
    Re: vi regex to preserve interior commas in CSV string <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 14 Dec 2011 11:30:27 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: Question on using perl in a cgi script
Message-Id: <33ac66b4-3c4b-4981-a821-058b23e6f04c@l29g2000yqf.googlegroups.com>

On Dec 14, 2:37=A0am, q-rious <mit...@juno.com> wrote:
> I want to build a cgi script using perl that will continously loop throug=
h the following:
>
> a) read from a line from a one line file
> b) draw something on the screen based on that value (using gd)
>
> I can do this for one iteration of the loop. But how do I update the brow=
ser screen for multiple iterations?

Your hypothetical CGI script might look something like this:
use warnings;
use strict;
use CGI;
my $what =3D param('what');
#present HTML form unless 'draw' is clicked
unless ($what eq 'draw')
{
  print qq(<html><body><form><input type=3D"submit" name=3D"what"
value=3D"draw" /></form></body></html>);
}
#draw lines from file if 'draw' is clicked
elsif ($what eq 'draw')
{
  print qq(<html><body>);
  open DRAW, '<', 'draw.txt' or die "$!";
  while (<DRAW>) { print $_; }
  close DRAW;
  print qq(</body></html>);
}
else
{
  print qq(<html><body><h1>ERROR!</h1></body></html>);
}
exit(0);

This script WILL NOT RETURN a resource to the HTTP server until it has
finished executing, IOW, until the entire file has been read, the HTML
has been generated in its entirety, and the script exits. At that
point, the web server will return the resource which consists of the
complete drawing.

I can think of several ways to do what you say you want to do, but
they are all ugly. Perhaps the simplest is to return a JavaScript file
that will programatically draw what you want, but that would run a
client side script rather than a server side script (which is what CGI
does).

You could write an Applet to do the same thing, but that's not CGI.

I don't think you want repeated HTTP requests and responses bouncing
back and forth between your browser and the server -- the latency
would kill you.

You might want to post a program or the pseudo code for what you want
if you think this does not respond to what you think you asked.

CC.


------------------------------

Date: Wed, 14 Dec 2011 11:07:39 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: vi regex to preserve interior commas in CSV string
Message-Id: <64e96db4-b238-4889-bc5a-d86bc827c694@f39g2000yqn.googlegroups.com>

On Dec 13, 5:32=A0pm, Tad McClellan <ta...@seesig.invalid> wrote:
> So then, you are missing some single quotes in your ROW EXAMPLE 2.

I made a mistake when typing.

I have discovered that vi will do a lot of what I write little Perl
scripts to do, such as convert the output of Excel to a format that I
can use. I'm just not that good (yet) with vi regexes.

Thanks, CC.


------------------------------

Date: Wed, 14 Dec 2011 22:16:46 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: vi regex to preserve interior commas in CSV string
Message-Id: <erjnr8-i82.ln1@anubis.morrow.me.uk>


Quoth ccc31807 <cartercc@gmail.com>:
> 
> I have discovered that vi will do a lot of what I write little Perl
> scripts to do, such as convert the output of Excel to a format that I
> can use. I'm just not that good (yet) with vi regexes.

How entirely fascinating.

What was your Perl question?

Ben



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 3568
***************************************


home help back first fref pref prev next nref lref last post