Ask a Question related to PERL Miscellaneous, Design and Development.
-
corky #1
CGI: Help with "loading" message while processing.
Using Perl 5.6.0. I need to temporarily show a message while I process
in the background. The process calls an OLE component which sets a
value in the user's cookie.
The DisplaySecSubmit sub calls my "please wait" page which is static.
The GetSecureModels sub runs the OLE process and sets the cookie.
The DisplaySubmit sub displays a new page which uses the cookie which
was just set.
Here is where it starts:
elsif ($FORM{'FUNC'} eq 'DISP_SEC_SUBMIT')
{&RightViolation($CREATE_RIGHT) if (($createRight == 0) &&
($a_createRight == 0));
&DisplaySecSubmit();
&GetSecureModels();
&DisplaySubmit();
}
use Win32::OLE;
use DBI;
use DBD::ODBC;
sub GetSecureModels{
if (length($trainedOn) < 1){
$dbh = DBI->connect("dbi:ODBC:support", exsu, exsupwd)|| die "Can't
connect !!: $DBI::errstr";
$dbh -> {RaiseError} = 1;
$stmt = "SELECT DISTINCT CTI_MODEL, MODEL FROM MODEL_LOOKUP WHERE
STATUS = 'ACTIVE' AND CLASS_FAMILY IN (SELECT DISTINCT FAMILY FROM
MODEL_FAMILY) ORDER BY MODEL;";
$sth = $dbh->prepare($stmt)|| die "Error on prepare $DBI::errstr";
$sth->execute()|| die "Error on Execute $DBI::errstr";
while (@row = $sth->fetchrow_array) {
my $server = Win32::OLE->new('auth.caller','Quit');
$server->{Model} = $row[0];
$server->{NSSGID} = $userID;
my $trainstat = $server->{Verify};
if ($trainstat ne -1 ) {
push @trainedOn , $row[1];
}
}
$trainedOn = join ',', @trainedOn;
print "Content-type: text/html; charset=utf-8\n";
&SetCompressedCookies('MODELS','trainedOn', $trainedOn);
print "\n";
}
}
sub DisplaySecSubmit{
&set_submit_strings();
&EchoFile($HTML_PATH, "traincheck.htm");
}
My problem is that it seems as though each individual CGI call will
only return a single page of output. For example, I show my "please
wait" message while I'm processing and when processing is done the
results are appended to the "please wait" message instead of replacing
it.
Another problem is that the cookie stuff shows in the browser too.
Is there any way to flush or start with a clear screen? Can I run the
process on a different thread? Can I use refreshes to handle this? Or
should I use a combination of approaches?
I only use Perl once a year or so as necessary, and as a consequence
this may be a simple problem with a simple answer, so please forgive
me.
Thanks in advance for any help,
Corky
corky Guest
-
"error Occurred while Processing request" uponColdfusion installation
Hello Im aboslutely new to web development, except for being able to produce not dinamic web pages. I am a beginner to Coldfusion, and I have... -
how to add "loading.." message
I am fairly new to Flash programming ... some of my movies are fairly slow loading especially with a poor connection ... How can I add the "Loading,... -
Form processing: change the "action=" based on pull down menu
Hi group - I have an html form for that uses username and password to login to a specific area of the website. The "area" the user wants to go to... -
Script "terminates" when processing large numbers of files
Hi, I'm running a script that reads through large numbers of html files (1500-2000 or so) in each of about 20 directories, searching for strings in... -
Get an error message when loading photoshop 7 (saying it is missing "sprof.dll" )
reinstalling doesn't fix problem can someone help ?????? -
Tom #2
Re: CGI: Help with "loading" message while processing.
[email]twistdpair@hotmail.com[/email] (corky) wrote in message news:<e2d5abce.0309151249.792a8e06@posting.google. com>...
You can open multiple windows by simply including a JavaScript open> Using Perl 5.6.0. I need to temporarily show a message while I process
> in the background. The process calls an OLE component which sets a
> value in the user's cookie.
>
> The DisplaySecSubmit sub calls my "please wait" page which is static.
> The GetSecureModels sub runs the OLE process and sets the cookie.
> The DisplaySubmit sub displays a new page which uses the cookie which
> was just set.
>
> Here is where it starts:
>
> elsif ($FORM{'FUNC'} eq 'DISP_SEC_SUBMIT')
> {&RightViolation($CREATE_RIGHT) if (($createRight == 0) &&
> ($a_createRight == 0));
> &DisplaySecSubmit();
> &GetSecureModels();
> &DisplaySubmit();
> }
>
> use Win32::OLE;
> use DBI;
> use DBD::ODBC;
>
>
> sub GetSecureModels{
> if (length($trainedOn) < 1){
> $dbh = DBI->connect("dbi:ODBC:support", exsu, exsupwd)|| die "Can't
> connect !!: $DBI::errstr";
> $dbh -> {RaiseError} = 1;
> $stmt = "SELECT DISTINCT CTI_MODEL, MODEL FROM MODEL_LOOKUP WHERE
> STATUS = 'ACTIVE' AND CLASS_FAMILY IN (SELECT DISTINCT FAMILY FROM
> MODEL_FAMILY) ORDER BY MODEL;";
> $sth = $dbh->prepare($stmt)|| die "Error on prepare $DBI::errstr";
> $sth->execute()|| die "Error on Execute $DBI::errstr";
> while (@row = $sth->fetchrow_array) {
> my $server = Win32::OLE->new('auth.caller','Quit');
> $server->{Model} = $row[0];
> $server->{NSSGID} = $userID;
> my $trainstat = $server->{Verify};
> if ($trainstat ne -1 ) {
> push @trainedOn , $row[1];
> }
> }
> $trainedOn = join ',', @trainedOn;
> print "Content-type: text/html; charset=utf-8\n";
> &SetCompressedCookies('MODELS','trainedOn', $trainedOn);
> print "\n";
> }
> }
>
>
> sub DisplaySecSubmit{
> &set_submit_strings();
> &EchoFile($HTML_PATH, "traincheck.htm");
> }
>
> My problem is that it seems as though each individual CGI call will
> only return a single page of output. For example, I show my "please
> wait" message while I'm processing and when processing is done the
> results are appended to the "please wait" message instead of replacing
> it.
>
> Another problem is that the cookie stuff shows in the browser too.
>
> Is there any way to flush or start with a clear screen? Can I run the
> process on a different thread? Can I use refreshes to handle this? Or
> should I use a combination of approaches?
function in you HTML document. For example, when you submit the query
using the input form generated by the code below, the browser will
open a new window with your messages.
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
print header("text/html");
if(param("DISP_SEC_SUBMIT"))
{
&DisplaySecSubmit();
&GetSecureModels();
exit;
}
my $script = "form.cgi";
print <<FORM;
</head><body onUnload='javascript:msg.window.close()'>
<script language='JavaScript'>
function wait()
{
msg = window.open("","msg","width=600,height=150");
msg.document.open("text/html");
msg.document.write("Please wait...");
return true;
}
var msg;
</script>
<h3>FORM TITLE...</h3>
<form method=post action=$script onSubmit='return wait()'>
<table><tr><th>SecureModels:<td><input name='DISP_SEC_SUBMIT'
value='SecureModels value...'>
<tr><td><input type=submit></table></form>
FORM
sub DisplaySecSubmit
{
print "DisplaySecSubmit...<p>";
my $trainedOn = "SELECT DISTINCT...";
&SetCompressedCookies('MODELS','trainedOn', $trainedOn);
sleep(2);
print "\n";
}
sub SetCompressedCookies
{
print "SetCompressedCookies...<p>ARGUMENTS: @_";
sleep(2);
}
sub GetSecureModels
{
print "<hr>GetSecureModels...<p>";
}
As you can see, the above solution is more of JavaScript than PERL. So> I only use Perl once a year or so as necessary, and as a consequence
> this may be a simple problem with a simple answer, so please forgive
> me.
>
any follow-up should be directed to the appropriated group such as
comp.lang.javascript.
Tom
Ztml.com
Tom Guest
-
corky #3
Re: CGI: Help with "loading" message while processing.
Thanks, Tom. This looks like a good solution.
-corky
corky Guest



Reply With Quote

