Using PPMs on Mac OSX
If you wish to use ActivePerl on Mac OSX the the PPMs provided at this site
will give you a binary build of Wx for GUI development. ActivePerl is a
good choice on Mac OSX if you intend distributing your Wx applications to
other machines perhaps with PerlApp or to run natively on an
install of ActivePerl. It can also be beneficial if you are building an
application to deploy on more than one platform to have a reasonable
degree of conformity in your Perl and Wx installation across all the
platforms you wish to deploy to.
The PPM's at this site are built as Universal Binaries for ActivePerl 5.8 / 5.10 builds 825/1002 and above. The minimum Mac OSX version required is 10.4.
If you accepted the default installation options for ActivePerl, it is likely you have perl installed at
/usr/local/ActivePerl-5.10
Use thePerl Package Manager (/usr/local/ActivePerl-5.10/bin/ppm) to install Wx ppms as described here.
Again, assuming you accepted defaults, the PPMs you installed will be placed in
/Users/yourname/Library/ActivePerl-5.10
The OSX system expects GUI applications to be provided as 'app' bundles. The PPMs you installed (as with the standard CPAN distribution) placed a special executable, wxPerl, at
/Users/yourname/Library/ActivePerl-5.10/bin/wxPerl
You should use this to execute your wx development scripts. You will use it to execute the Wx::Demo script
/Users/yourname/Library/ActivePerl-5.10/bin/wxPerl /Users/yourname/Library/ActivePerl-5.10/bin/wxperl_demo.pl
One thing you will notice is that your wxPerl GUI application is not brought to the front. This is one of the peculiarities of working on Mac OSX. If the app were brought to the front, you would break the link to the terminal from which you launched the script - and see no output. This is undesirable when you are developing using Perl.
If you are running MaxOSX 10.6 (Snow Leopard) or later, you can, if you wish, setup a shell script to launch wxPerl scripts and bring the application to the front, whilst, of course, breaking the connection to your terminal.
Create a text file called
/Users/yourname/Library/ActivePerl-5.10/bin/wxPerlGui
Then write the contents of the file in a text editor as follows
#!/bin/sh
/usr/bin/open -n -a /Users/yourname/Library/ActivePerl-5.10/lib/auto/Wx/wxPerl.app --args $@
save it and chmod it as executable.
Now you can do
/Users/yourname/Library/ActivePerl-5.10/bin/wxPerlGui /Users/yourname/Library/ActivePerl-5.10/bin/wxperl_demo.pl
Now the 'app' is brought to the front, but you get no output at the terminal. Unfortunately, versions of MacOSX prior to 10.6 do not support the --args parameter to 'open' so you cannot do this with those versions. You could set up individual sh scripts to launch each of your perl scripts - but you could not pass in parameters. Check 'man open' to see which options are supported in your version on MacOSX.
NOTE: Mac OSX has its own version of Perl installed that includes a build of wxPerl. Be sure that your environment is set appropriately so that you are calling the correct Perl.
The PPM's at this site are built as Universal Binaries for ActivePerl 5.8 / 5.10 builds 825/1002 and above. The minimum Mac OSX version required is 10.4.
If you accepted the default installation options for ActivePerl, it is likely you have perl installed at
/usr/local/ActivePerl-5.10
Use thePerl Package Manager (/usr/local/ActivePerl-5.10/bin/ppm) to install Wx ppms as described here.
Again, assuming you accepted defaults, the PPMs you installed will be placed in
/Users/yourname/Library/ActivePerl-5.10
The OSX system expects GUI applications to be provided as 'app' bundles. The PPMs you installed (as with the standard CPAN distribution) placed a special executable, wxPerl, at
/Users/yourname/Library/ActivePerl-5.10/bin/wxPerl
You should use this to execute your wx development scripts. You will use it to execute the Wx::Demo script
/Users/yourname/Library/ActivePerl-5.10/bin/wxPerl /Users/yourname/Library/ActivePerl-5.10/bin/wxperl_demo.pl
One thing you will notice is that your wxPerl GUI application is not brought to the front. This is one of the peculiarities of working on Mac OSX. If the app were brought to the front, you would break the link to the terminal from which you launched the script - and see no output. This is undesirable when you are developing using Perl.
If you are running MaxOSX 10.6 (Snow Leopard) or later, you can, if you wish, setup a shell script to launch wxPerl scripts and bring the application to the front, whilst, of course, breaking the connection to your terminal.
Create a text file called
/Users/yourname/Library/ActivePerl-5.10/bin/wxPerlGui
Then write the contents of the file in a text editor as follows
#!/bin/sh
/usr/bin/open -n -a /Users/yourname/Library/ActivePerl-5.10/lib/auto/Wx/wxPerl.app --args $@
save it and chmod it as executable.
Now you can do
/Users/yourname/Library/ActivePerl-5.10/bin/wxPerlGui /Users/yourname/Library/ActivePerl-5.10/bin/wxperl_demo.pl
Now the 'app' is brought to the front, but you get no output at the terminal. Unfortunately, versions of MacOSX prior to 10.6 do not support the --args parameter to 'open' so you cannot do this with those versions. You could set up individual sh scripts to launch each of your perl scripts - but you could not pass in parameters. Check 'man open' to see which options are supported in your version on MacOSX.
NOTE: Mac OSX has its own version of Perl installed that includes a build of wxPerl. Be sure that your environment is set appropriately so that you are calling the correct Perl.