Developing and Distributing wxPerl Applications on Windows
Introduction
This article is about installing wxPerl under Strawberry Perl for application development and distribution as a Windows executable.
Instructions are provided with the versions detailed below. If there are newer versions of any of the modules, you may try it out (of course); but understand they have not been tried out and shown to work like version combinations below.
Installation
Step 1 - Install Strawberry Perl
Install via following link,
Step 2 - Install Alien::wxWidgets (v 0.70)
Once Perl is installed, look in the Start menu for the Perl "cmd" window or open up PowerShell
- go to "Start menu" > Strawberry Perl > "Perl (command line)"
- click the Start menu item, it'll open up a Windows CMD window (traditional black DOS prompt)
Type the command at the "C:" prompt,
C:\> cpanm --verbose https://github.com/sciurius/wxPerl/releases/download/R3.004/Alien-wxWidgets-0.70.tar.gz
Step 3 - Install Wx (v 3.005)
C:\> cpanm --verbose https://github.com/sciurius/wxPerl/releases/download/R3.005/Wx-3.005.tar.gz
Verify Installation
Install Wx::Demo
Wx::Demo is nice demonstration application, highlight many (if not all) of the wxWidget features available via xPerl.
C:\> cpanm --verbose Wx::Demo
.. then once installed, run it with this command (which is available in the PATH already),
C:\> wxperl_demo.pl
Install wxGlade
wxGlade is a GUI builder for wxWidgets applications. It is written in Python, but critically supports outputing Perl code. It is actively developed, the developer is very responsive on Github to bugs and feature requests. It is the closest thing we have in Perl to a RAD (rapid application development) environment (e.g., Lazarus for FreePascal).
Step 1 - Install Python 3.10 for Windows
Install via following link,
https://www.python.org/ftp/python/3.12.8/python-3.12.8-amd64.exe (linked here)
Step 2 - Download and unzip wxGlade
https://github.com/wxGlade/wxGlade/archive/refs/tags/v1.1.0.zip
Via Windows CMD terminal, navigate to the unzip'd directory and run the command,
C:\> python wxglade.py
Development Workflow Notes
Packaging and Distributing Windows Executables
This section is more of a work in progress since a reliable method of distributing single file executables (or developing installation packages for Windows) is still an open question, there is hope that this will end up being a relatively smooth process. Needless to say, it is critical for Perl developer to be able to distribute Perl based GUI applications as single file (.exe) or via installation on Windows. The client should NOT need to be running through any of the instructions above to run a program that you would like to sell them for actual money.
Below are the initial instructions for generating an EXE file.
Step 1 - Install PAR::Package and Wx::Perl::Packager
C:\> cpanm --verbose PAR::Package Wx::Perl::Packager
Step 2 - Generate the EXE
Assuming you have a Perl script generated either via wxGlade (see above) or one you have created/updated by hand, the command is as follows:
C:\> wxpar YOURPROGRAM.pl -o YOURPROGRAM.exe