Re: Gas gauge ??
by Roger (Parson) on Jan 08, 2004 at 02:08 UTC
|
| [reply] |
|
|
Hi Roger,
I tried the example from Cpan, but got a "Can't locate CGI/ProgressBar.pm in @INC ..." message, so have asked the web hosts to install that module.
The current shebang line,etc is
#!/usr/bin/perl -wT
use CGI qw/:standard/;
use DBI;
use Net::SMTP;
#use CGI::Carp qw(fatalsToBrowser); #comment this out when in produ
+ction
BEGIN {
use CGI::Carp qw(carpout);
open(LOG, ">>/home/username/cgi-bin/process-log") or
die("Unable to open process-log: $!\n");
carpout(LOG);
}
# resource limits
$CGI::DISABLE_UPLOADS = 1; # no uploads
$CGI::POST_MAX = 1024 * 10; # max 10K posts
Looking at the example on Cpan, would the insertion of the following
use lib '..';
use CGI::ProgressBar qw/:standard/;
$| = 1; # Do not buffer output
have any other effect on the displaying of error messages (currently to browser), or other o/p to the browser (HTML code,etc) ?
Peter
| [reply] [d/l] [select] |
|
|
I don't think you need the use lib '..' bit. My gut feeling is that turning off buffering is not likely going to affect the printing of the error messages (well, maybe performance wise). But you will need to test it of course.
| [reply] [d/l] |
|
|
Re: Gas gauge ??
by Zaxo (Archbishop) on Jan 08, 2004 at 02:09 UTC
|
Inflicting things on the browser is javascript's job. The cgi server has no connection with the user's browser except for what's in the web page. See perldoc CGI for help on writing javascript from perl. It's no big trick - you just write it along with the rest of the text.
You might look at "server push", but that's an old idea nobody liked.
Update: I forgot, at first, that if you haven't finished printing the page, you can print messages to it periodically.
| [reply] |
|
|
Hi Zaxo,
Thanks for the link to "CGI, there were some interesting examples there about how to use JS. I guess my post is two-fold, one is to inform the user some way (gas gauge, JS,etc), and the other is to continue processing, even if the user presses 'stop' or closes the browser window. I think sometimes they are getting too impatient and just exiting, thinking that everything is done. Ideally, I would like to give them the opportunity to close/exit after they press the "Confirm/submit" button, and simply continue doing all the processing. The logs at present indicate some users have no idea that it is still 'processing'.
I have been reading this node on Lauching multiple processes, which may be the way to go (spawn a child process) ?
Thanks,
Peter
| [reply] |
Re: Gas gauge ??
by dragonchild (Archbishop) on Jan 08, 2004 at 04:03 UTC
|
One thing a place I worked at did was to create two ... I forget what they're called, but you could swap them back and forth with a simple JS command. It's kinda like a graphics buffer. When animation is drawn, the picture is drawn in an unseen buffer, then it's swapped with the viewing buffer while the other buffer (which was viewed) is now the drawing buffer. That way, the user doesn't see the drawing occur.
------
We are the carpenters and bricklayers of the Information Age.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
| [reply] |
|
|
One thing a place I worked at did was to create two ... I forget what they're called, but you could swap them back and forth with a simple JS command. It's kinda like a graphics buffer. When animation is drawn, the picture is drawn in an unseen buffer, then it's swapped with the viewing buffer while the other buffer (which was viewed) is now the drawing buffer. That way, the user doesn't see the drawing occur.
Sort of a bit like the JS "onmouseover/onmouseout" events, where you define two images, and as the user places the mouse over the image, it changes to the other image. But what you describe causes an 'animation' automatically, from Perl.
Thanks,
Peter
| [reply] |
|
|
Actually, I found it. It's the <layer> tag. You can find more info about it here.
------
We are the carpenters and bricklayers of the Information Age.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
| [reply] |
|
|
|
|
|
|
|