Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Making a GUI based Win32 app from Perl script.

by Speedfreak (Sexton)
on Nov 18, 2002 at 09:55 UTC ( #213702=perlquestion: print w/replies, xml ) Need Help??

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

Hej All,

I recently had a problem of data in one file format and needed to convert it to another. Being both text based, I hacked together a dandy little perl script to do the job. I tend to use perl for any text file scripts I do.

Anyway, it turns out that theres a lot of demand for the converter I wrote (it takes data from a 3D modelling program and converts it for use in a 3rd party render engine) and I plan to release the script as GPL for those that want it.

The script does nothing too special - it just opens two text files, parses them using a coule of regexps and pulls the data into arrays and then, after some sorting, re-writes the arrays out to another text file in the new format.

However, most of the user base for the script are Windows users, many running XP and the fact they will need to install Perl and use a command line will seriously reduce the pick-up/user base of the script.

So I'm wondering - is their an easy tool I could use to make my perl a simple stand-alone Win 32-bit app? I considered porting it to C++ and trying to find someone to help code a GUI front end but so far haven't had any luck searching the web for a perl2c++ converter. I dont even know if C++ supports regexp :o/

Can anyone shed any light, opinions on the best way to get this small, 3k script self-contained and useable to Windows users?

- Jed

edited: Mon Nov 18 15:34:27 2002 by jeffa - formatting adjustments

  • Comment on Making a GUI based Win32 app from Perl script.

Replies are listed 'Best First'.
Re: Making a GUI based Win32 app from Perl script.
by dree (Monsignor) on Nov 18, 2002 at 10:42 UTC
    There are several GUIs that you can use:

    Win32::GUI
    very easy to program, it uses the Win32 API, so the GUI has the look and feel of Windows.
    It works only for Win32 platforms

    Tk
    easy to program, it is multiplatform (*nix, Windows), well documented (there is also an excellent book: Mastering Perl/Tk by O'Reilly), but it has its own look and feel

    Wx
    Object Oriented, it is multiplatform but has the look and feel of the WM used by the OS (so on Windows it looks like Win32::GUI)

    Prima
    multiplatform GUI with its own look and feel, useful expecially with 2D graphics


    To made an exe from the script, you have 4 ways, 2 commercials and 2 open source:

    1) perl2exe by Indigostar

    2) perlapp by Activestate (part of the Perl Development Kit)

    are 2 excellents tools that made your script an executable program (for Win32 and some *nix). They are mature products with pros and cons.

    3)rd way is PAR an open source packer, that will merge soon with

    4) App::Packer, the 2nd open source way to do Perl executables
      PAR (is) an open source packer that will merge soon with App::Packer

      Hmmm. Could you elaborate on this? As I mentioned elsewhere, I'm wondering about the tradeoffs betwen these two approaches. Now these projects are going to be combined?

      laughingboy

        From "Changes" file in the App::Packer tarball, I read:

        0.08 Thu Nov 07 15:36:35 CET 2002 - App::Packer will join efforts with PAR "soon";

        But I know that Mattia has a lot of College Homeworks to do before :))
Re: Making a GUI based Win32 app from Perl script.
by dingus (Friar) on Nov 18, 2002 at 11:39 UTC
    You might want to take a look at the POPfile project on sourceforge since this has developed in a similar sort of way to your project and does have a windows user version as well as a multiplatform perl/CLI version.

    There are, I think, 3 separate problems that you face. Each is solvable, but since you have 3 problems you need to solve, looking for a single solution may not be the best.

    Problem 1 - GUI front end
    Many solutions talking about Tk or Win32::API or ... have been mentioned. All of these will work. However they may require more work than you wish.

    An alternative that you may not have thought of is to build a quick and dirty web server and use the web browser your users almost certainly already have to submit files and report status / results. The great advantage of the web server / broswer combo is that you don't have to do any programming of objects and events. The fact that you also are immediately platform independant is nice too.

    Problem 2 - hiding the Perl CLI console
    This is easy, just setup the shortcut to do
    wperl.exe mysctipt.pl

    Problem 3 - not requiring that the user have Perl
    From the description of your script you would need few if any perl modules. If you created a zip file with wperl.exe, perl56.dll, script.pl and the few libraries you need (say IO::?? File::?? and some basics such as Autoloader.pm) then this could all be installed in a single directory tree on your user's PC irrespective of whether they had perl or not. This is, essentially, the route taken by popfile and it has a number of advantages in comparison with the single .exe solutions you get with perl2exe and its friends. For one it makes patches and updates easy and compact. It also means that if you ever want to do an OS/X version (or Linux or ...) then you don't have to find the other OS equivalents of perl2exe.

    Dingus


    Enter any 47-digit prime number to continue.
Re: Making a GUI based Win32 app from Perl script.
by sch (Pilgrim) on Nov 18, 2002 at 10:28 UTC

    Maybe this can give some ideas?

    But today you took me walking, Through a land that we have lost,
    While our children sit at websites, With no access to the cost

Re: Making a GUI based Win32 app from Perl script.
by Tanalis (Curate) on Nov 18, 2002 at 10:23 UTC
    Maybe an easy way to write a quick GUI for the app would be using the Tk module, which is pretty much platform-independant. It's fairly quick and easy to use, although it is a little limited in what it can do. If all you need is two file names and a "Go" button, it's probably ideal :)

    There's a utility that lets you compile a Perl script as a .exe, called (cunningly) perl2exe, which is available here. It's not something I've used, but it looks like it'd do the job from the website.

    Hope that helps a little ..
    --Foxcub

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://213702]
Approved by mce
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2019-10-16 19:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?