MonkPaul has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,

I have an impending situation at the moment with a project i have been working on the last few months.

What i have been creating is a web based application to process biology BLAST reports (if any of your are familiar with them).

This was required to be presented as a web page, which has been done. (If you want a look then get in touch).

Now the person im working for thought it would be a good idea to tell me at the last stage that they wanted it to be available as a standalone package as well.

And so my question is: Can i easliy convert my CGI script and modules into a form that can use the windows explorer windows as the interface front end, then produce output into this without loading up the script in th window, OR, having to create a new interface and script specifically for standalone versions.

Cheers,
MonkPaul.

  • Comment on Conversion from Web script to stand-alone

Replies are listed 'Best First'.
Re: Conversion from Web script to stand-alone
by Joost (Canon) on Aug 13, 2005 at 14:56 UTC
    Can i easliy convert my CGI script and modules into a form that can use the windows explorer windows as the interface front end,

    I'm assuming you mean Internet Explorer.

    then produce output into this without loading up the script in th window,

    Huh? What do you mean by "loading up the script" ?

    OR, having to create a new interface and script specifically for standalone versions.

    You might be able to port the whole thing to a stand-alone application with a built-in web-server. See HTTP::Server::Simple. Looks reasonably straight-forward. If you need other applications (like a database server) you'd have to find easy-to install alternatives for those too (like SQL Lite).

      I second the idea of porting the program to a stand-alone application with a built-in web server, as an alternative to HTTP::Server::Simple you could try HTTP::Daemon (it's what I've used when I've done this before).

      The way this will work is that you'll be pointing Internet Explorer (or your other web browser of choice) to your local machine, something like http://localhost:8080 (the number represents the port that the HTTP server is running on, and can be changed).

      Hi,

      At the moment its stored on a Linux box so can be run through any web browser, but what i meant was the windows explorer interface. The interface that runs Windows. Not internet explorer.

      At present when you use the <form> tag in the html page and just use it to call a .pl or .pm file it just loads that into the window pane.

        That's because you need a HTTP server to process HTTP requests and spawn CGI scripts.

        Probably the easiest way to get this to work quickly is to use a simple HTTP server like the one I pointed to in my post), especially since you're apparently still using a default browser to look at the HTML pages (IE just embeds in the explorer window if you have it as the default browser) - you could just as well make a perl (or .bat) script that starts the HTTP server and then points IE to the start-page.

        But maybe I'm just misinterpreting what you're saying....

        what i meant was the windows explorer interface. The interface that runs Windows. Not internet explorer.

        The Windows Explorer interface can't do arbitrary things. It's just a file and folder management interface; it does not do much of anything else (okay so it does also display the taskbar...), and specifically it doesn't do any of the things you would normally use CGI for; it does not, for instance display or process the results of form elements. Mostly it copies files and launches application processes. I'm pretty sure what you actually meant was something other than the Windows Explorer interface. I'm not 100% certain what you did mean, but I'm pretty sure that that's not it. There must be a confusion of terminology (which is fairly common when dealing with Microsoft stuff).

        The question is whether you meant Internet Explorer, or the Win32 widget set, or some other thing. But you almost certainly didn't mean Windows Explorer, at least not if you have any real understanding of what Windows Explorer is or does. My best guess is that you meant the Win32 widget set (in which case, the answer is no, converting from CGI to that is not easy, and you should instead consider the other approach, which others have discussed, of using a standalone web-server module and allowing the user to use Internet Explorer as the interface even though the app is running on the local system, not remotely), but that is only a guess, because you have not described in precise detail exactly what you want.


        "In adjectives, with the addition of inflectional endings, a changeable long vowel (Qamets or Tsere) in an open, propretonic syllable will reduce to Vocal Shewa. This type of change occurs when the open, pretonic syllable of the masculine singular adjective becomes propretonic with the addition of inflectional endings."  — Pratico & Van Pelt, BBHG, p68
        The Windows Explorer, as in what you get when you press WindowsKey-E, is a subset of Internet Explorer since it became built into the operating system. If you pull up the Windows Explorer (WinKey-E) and then type "http://www.perlmonks.org" into the Address bar, it will load in the same window.

        Setting up a CGI to run off a local HTTP server and then creating a shortcut that loads a "http://localhost/whatever" is not paticularly hard and the user experience will be what you want - its the installation of such a setup that is going to be a hassle. You will need to install ActiveState Perl and a local HTTP server on any machine you want to deploy to.

        -Andrew.


        Andrew Tomazos  |  andrew@tomazos.com  |  www.tomazos.com
      Try PerlTK to create your own windowslike gui. but it wouldnt be easy, though.
Brute force?
by BerntB (Deacon) on Aug 13, 2005 at 22:53 UTC
    You can't just write a small command script that starts Infernal Explorer with an URL to your program?

    Brute force and ignorance -- don't underestimate it! :-)

    If you can't do that, it will be a bit of bother. You need people to install Perl. (-: Arguably, not a bad thing. :-)

    Let your program generate a temporary file and start Internet Explorer with that file.

    Someone that knows more than me about Windows and Win32::OLE are sure to expand on this ignorant newbie's post with more explicit advice on how to (a) find the temp dir on Win and (b) how to start Internet Exploder.

    Update: I assume above that the form parameters can easily be translated to command line parameters. The other answers assumes the configuration is too complex for that? If so, a small http server might be the best choice to translate your program fast (you need to copy/paste sequences, I guess?).

Re: Conversion from Web script to stand-alone
by srdst13 (Pilgrim) on Aug 14, 2005 at 01:02 UTC
    While this may be anathema here, have you thought of moving over to java? All the bio-based tools are available there as java classes. Then, your standalone will run nearly anywhere. The methods for making a user interface are also fairly well-developed. I find myself turning to CGI for nearly all of my perl-based GUI stuff, but for a standalone, CGI may be a bit of a bother, especially on the windows platform.

    Sean
      Or, alternatively Perl/Tk and PAR - to get a cross-platform standalone gui application.

      Learning Java may not be worth the hassle. This is because it is a terribly-pendantic overly-verbose closed-source slow-execution-time environment - with no access to CPAN or an equivilant. That's why not many things are written in it. Whoops. Did I say that outloud?

      -Andrew.


      Andrew Tomazos  |  andrew@tomazos.com  |  www.tomazos.com
        I guess I should look into PAR some more. I agree with your java poke(s). I haven't learned much yet, either.

        Sean