CGI: Help with "loading" message while processing.

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. "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...
    2. 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,...
    3. 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...
    4. 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...
    5. Get an error message when loading photoshop 7 (saying it is missing "sprof.dll" )
      reinstalling doesn't fix problem can someone help ??????
  3. #2

    Default Re: CGI: Help with "loading" message while processing.

    [email]twistdpair@hotmail.com[/email] (corky) wrote in message news:<e2d5abce.0309151249.792a8e06@posting.google. com>...
    > 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?
    You can open multiple windows by simply including a JavaScript open
    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>";
    }
    > 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.
    >
    As you can see, the above solution is more of JavaScript than PERL. So
    any follow-up should be directed to the appropriated group such as
    comp.lang.javascript.

    Tom
    Ztml.com
    Tom Guest

  4. #3

    Default Re: CGI: Help with "loading" message while processing.

    Thanks, Tom. This looks like a good solution.

    -corky
    corky Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139