Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: (nrd) Executing Perl Script from a Web Page

by newrisedesigns (Curate)
on Feb 11, 2003 at 13:03 UTC ( [id://234386]=note: print w/replies, xml ) Need Help??


in reply to Executing Perl Script from a Web Page

If it's an option, Apache's SSI would work.

Why do you need it to run without intervention? What are you trying to do?

John J Reiser
newrisedesigns.com

  • Comment on Re: (nrd) Executing Perl Script from a Web Page

Replies are listed 'Best First'.
Re: Re: (nrd) Executing Perl Script from a Web Page
by Eoin Redmond (Novice) on Feb 11, 2003 at 17:10 UTC

    Thanks John

    I'm in a Win32 environment with IIS.

    Here's what I'm trying to do:

    1. I'm uploading a large file and I need a way of letting the user know that something is happening.

    2. I'm using the javascript onSubmit event handler within the form to launch a web-page in another window. I don't think you can call a Perl script with this javascript event handler.

    3. I want the web-page opened in the second window to run a Perl script which will try and find out the progress of the file upload and let the user know.

    4. The above, of course, doesn't solve the problem of IIS timing out during a long file upload but that's another days work.

    Merlyn has written a example script that uses fork to deal with the problem of monitoring long running processes but it is a Unix based script and I couldn't get it to run in a Win32 environment and I'm not even sure if it can be adapted for Win32.

    Thanks

    Eoin

      2. I'm using the javascript onSubmit event handler within the form to launch a web-page in another window. I don't think you can call a Perl script with this javascript event handler.

      Not that I like js solutions but you can open anyfile in a new window using any handlers, just do:

      <form method="post" action="youscript.cgi" onSubmit="open('your_check_ +script.cgi')">

      You can pass some extra parameters to the open function to define how you want it to appear (size scrollbars etc.)

      Hope that helps.
      Chris

      Lobster Aliens Are attacking the world!

      Correction to my previous post to John

      You can launch a Perl script from javascript

      example:

      <SCRIPT LANGUAGE="JavaScript"> function showProgress() { var newWindow = open("http://localhost/cgi-bin/test.pl", "secondWindow +", "scrollbars,resizable,width=250,height=150,left=720"); } </script>

      The form element would contain the following javascript event handler:

      onSubmit="showProgress()

      Eoin

      This depends on a few things... but, you could have a Perl script that watches the file upload by how much of the file is uploaded so far. You can steal the size of the file from the Content-size: header, pass it to the second script as a query string, and have the script return a page with a meta refresh tag so the page will reload every second or so.

      That's putting more strain on the server; how important is it to have a window display the current upload?

      John J Reiser
      newrisedesigns.com

        Thanks John

        I actually went down the route you suggested using a little more javascript then you mentioned. Again I ran into the problem that the upload file wasn't actully written out on the server until the entire file had been upload

        Obviously the process is storing the chunks of uploaded data in a temp file or cache until everything has been uploaded so my second Perl script has nothing to report on until the file is finally uploaded which, of course, is too late

        Just about to give up on this approach and simply have my second Perl script just display a file uploading message and exit when the file has been uploaded

        Unless you can access the data as its being uploaded then this approach won't work. Still, I learned a lot of stuff trying it out

        Thanks

        Eoin

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://234386]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-23 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found