tag:blogger.com,1999:blog-68642044285664276402024-03-13T08:09:21.905+00:00$app->MainLoop();Perl GUI application development and distribution.Unknownnoreply@blogger.comBlogger13125tag:blogger.com,1999:blog-6864204428566427640.post-68847206109242368222013-02-02T08:39:00.003+00:002013-02-02T19:20:05.633+00:00Citrus on Raspberry PiI returned to messing around with the <a href="http://www.raspberrypi.org/">Raspberry Pi</a> over the last couple of days and finally got around to publishing the Citrus Perl distribution for Raspberry and the start of a distribution wrapping various Raspberry GPIO libraries and hardware.<br />
<br />
<span style="font-size: large;"><a href="http://raspberrypi.citrusperl.com/">Citrus & Raspberry Pi</a></span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6864204428566427640.post-47152030607820822172012-11-07T16:11:00.003+00:002013-01-29T02:05:55.042+00:00wxPerl on Raspbian<i>Edited 14 November 2012 to add use of qcow2 images and add kernel I compiled</i>.<br />
<br />
Following my initial post about <a href="http://binaryperl.blogspot.co.uk/2012/11/fun-things-still-happen.html" target="_blank">wxPerl and Raspberry Pi</a>, I thought I had better retrace the steps I took to create my environment and post a howto. So, read on only if that interest you.<br />
<br />
This is to get Rasbian, the debian based distro for Rasberry Pi working under Qemu on Windows, and then to install a custom Perl and wxPerl. I should point out that as far as can recall this is my first serious venture into using Qemu so it is very much a beginner's approach.<br />
<br />
First you need Qemu for Windows. I downloaded the latest pre-built binary zip Qemu-1.2.0-windows.zip from <a href="http://lassauge.free.fr/qemu/">http://lassauge.free.fr/qemu/</a> .<br />
<br />
For convenience I just put everything into a single folder - C:\RaspberryPi. So you need to extract the contents of Qemu-1.2.0-windows.zip to C:\RaspberryPi so that you have, amongst other things, C:\RaspberryPi\qemu-system-armw.exe.<br />
<br />
Next you need a suitable qemu kernel. I used the instructions at <a href="http://xecdesign.com/compiling-a-kernel/">http://xecdesign.com/compiling-a-kernel/</a> to help in compiling my own kernel that can be downloaded at <a href="http://www.citrusperl.com/raspbian/qemu-arm-kernel.zip">qemu-arm-kernel.zip</a>. I did not follow the instructions quite to the letter - I extracted a config from a working qemu / Raspberry kernel to use as a starting point.<br />
<br />
Extract the contents of qemu-arm-kernel.zip (both kernel file and 'modules' sub-folder ) to your C:\RaspberryPi folder.<br />
<br />
And finally for downloads, we need the base Raspbian image. Get the 2012-10-28-wheezy-raspbian.zip from the <a href="http://www.raspberrypi.org/downloads" target="_blank">Raspberry Pi download page</a> - or you can use this direct link to the file : <a href="http://downloads.raspberrypi.org/images/raspbian/2012-10-28-wheezy-raspbian/2012-10-28-wheezy-raspbian.zip">2012-10-28-wheezy-raspbian.zip</a>. Extract the single file in that zip ( 2012-10-28-wheezy-raspbian.img ) to your C:\RaspberryPi folder.<br />
<br />
Time for a bit of explanation of the steps that follow. The 2012-10-28-wheezy-raspbian.img file is a 2GB raw disk image that is intended to be written to an SD card or other device - and then have the root partition resized to fit the SD card. The image provides a fully working environment - there just isn't much free space if you don't resize it.<br />
<br />
To resize our image, we are going to create a copy then rather cheekily we are going to load the first image under Qemu to give us simple tools to resize the copied image. The copied image is the one we will use to play with. There is probably a more efficient way to do this with some other ported tools and there are certainly easier ways working in a Linux environment. But the following way just uses the things you need anyway to run a Raspbian image under Qemu.<br />
<br />
Open a Command Prompt. In the command prompt we'll make our copy of the Raspbian image in the qcow2 format. We'll use the qcow2 format because the file size on disk will only increase as we use sectors. A 32GB raw format image would use 32GB on our hard disk even if 30GB are empty.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">cd C:\RaspberryPi</span><br />
<span style="font-family: Courier New, Courier, monospace;">qemu-img convert 2012-10-28-wheezy-raspbian.img -O </span><br />
<span style="font-family: Courier New, Courier, monospace;"> qcow2 </span><span style="font-family: 'Courier New', Courier, monospace;">myraspbian</span><span style="font-family: Courier New, Courier, monospace;">.qcow2</span><br />
<br />
Next we'll resize the new image. I've chosen to add 32GB to it, but the choice is yours.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">qemu-img resize myraspbian.qcow2 + 32G</span><br />
<br />
Now we are ready to launch the original raspbian image and use it to expand the filesystem on the second.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">qemu-system-armw -M versatilepb -cpu arm1176 </span><br />
<span style="font-family: Courier New, Courier, monospace;"> -hda 2012-10-28-wheezy-raspbian.img -hdb myraspbian.qcow2 </span><br />
<span style="font-family: Courier New, Courier, monospace;"> -kernel qemu-arm-kernel -m 256 -append "root=/dev/sda2"</span><br />
<br />
You can probably figure out what the params are doing, but 'versatilepb' is the board that Qemu will emulate and works OK for the Raspbian images, arm1176 is the type of CPU in a Raspberry Pi and '-m 256' tells Qemu the amount of RAM to allocate. There is no point specifying a higher number for RAM even if a Rasberry Pi board can support 512mb. The number 256 is the maximum that the Versatile board can support (and Qemu emulates ). The two raspbian images specified as -hda and -hdb will appear as devices /dev/sda and /dev/sdb to the versatilepb emulation. The OS will be loaded from /dev/sda2 and we can then go about resizing the /dev/sdb2 partition on our expanded myraspbian.qcow2.<br />
<br />
Having issued the qemu-system-armw command above, you should get the Raspberry Pi startup menu which is intended for first time use on a real Raspberry Pi. There is nothing we can usefully do on here for our purposes so you can just select 'finish' that should get you to a command prompt. At this stage, reboot to complete Raspbian's initial setup:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo shutdown -r now</span><br />
<br />
After reboot, you should end up at a login prompt. The default user / password combination for the raspbian images is<br />
<ul>
<li>username <span style="font-family: Courier New, Courier, monospace;"><i>pi</i></span></li>
<li>password <i style="font-family: 'Courier New', Courier, monospace;">raspberry</i></li>
</ul>
<div>
Use this to login. We'll use the GNOME Partition Editor to fix up our new image so we need to install it.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get update</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install gparted</span><br />
<br />
Start the LXDE graphical environment<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">startx</span><br />
<br />
The GNOME Partition Editor is listed under 'Other' in the application menu. By default the GUI will load details for /dev/sda. We want to alter /dev/sdb (which is our myraspbian.qcow2 ) so change to that using the dropdown at the top right of the GUI. Select /dev/sdb2 and selecting 'Partition' from the menu, you can select 'Resize/Move' to resize /dev/sdb2. You can just drag the bars in the GUI to resize to fit the free space on the 15GB image. Apply your changes ( your selections are just 'queued' to begin with) and when this is complete you can close the Editor. Log out of the LXDE graphical environment and shutdown the machine.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo shutdown - h now</span><br />
<br />
When shutdown is complete you can close the Qemu Window.<br />
<br />
Now we are ready to boot our new resized raspbian image.<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">qemu-system-armw -M versatilepb -cpu arm1176 -hda myraspbian.qcow2</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> -kernel qemu-arm-kernel -m 256 -append "root=/dev/sda2"</span><br />
<br />
At first startup you will get some error messages ( which result because of the resize we just did ) and be dumped to a rescue prompt. You can fix the filesystem, as suggested by the error messages, with<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo fsck /dev/sda2</span><br />
<br />
and reboot the system<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo shutdown -r now</span><br />
<br />
When the system has rebooted, you will be presented with the Raspbian startup menu. This time you may wish to make some selections for your keyboard and locale. After you exit the setup you will be logged in as user 'pi'.<br />
<br />
The first thing to do is setup your X configuration so that you get the maximum resolution supported in the Qemu emulation. This appears to be 800x600. (A real Raspberry Pi board supports much higher resolutions). You will need to add an xorg.conf file to your configuration. I've provided one that works for me for a simple install<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">cd /etc/X11</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo wget http://www.citrusperl.com/raspbian/xorg.conf</span><br />
<br />
and for this to have any effect we will have to reboot<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo shutdown -r now</span><br />
<br />
After reboot you will have to login as user pi with password raspberry.<br />
<br />
Now you are ready to build wxPerl. I never use the system Perl for development as your stuff and the system stuff will always fall into conflict so the first thing to do is to build a Perl. Building from source on a Qemu emulated ARM environment takes a very very long time. To save you the effort if you wish, I have uploaded a complete tarball of the Perl and wxPerl that I built that you can install.<br />
<br />
I installed my Perl to /var/local/xperl and for the download simply gzipped a tar of the xperl directory for distribution.<br />
<br />
But first thing is first. You will need a development environment whether you use the download tar.gz or build yourself. The default gcc in Debian Wheezy is 4.6.3 but this has a bug on the ARM architecture that causes the compilation of Perl to fail. You need to install a gcc-4.7 based environment.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get update</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install make</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install gcc-4.7</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install g++-4.7</span><br />
<br />
To install a pre-built Perl and wxPerl<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">cd /var/local</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo wget http://www.citrusperl.com/raspbian/raspbixperl.tar.gz</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo tar xzf raspbixperl.tar.gz</span><br />
<br />
While the rest of this post is concerned with running Raspbian under Qemu, you could also install the above Perl / wxPerl to Raspbian on a real Raspberry Pi.<br />
<br />
To run wxPerl we need to be in a graphical environment so<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">startx</span><br />
<br />
Open an LXTerminal, prepend the custom Perl to your path, and run the Wx::Demo<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">export PATH=/var/local/xperl/site/bin:/var/local/xperl/bin:$PATH</span><br />
<span style="font-family: Courier New, Courier, monospace;">wxperl_demo.pl</span><br />
<br />
And that's it.<br />
<br />
If you really want to build Perl 5.16.2 and Wx yourself then my configure for Perl was:<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">export RASPBPREFIX=/var/local/xperl</span><br />
<span style="font-family: Courier New, Courier, monospace;">export FLG1="-DUSE_SITECUSTOMIZE -D_FORTIFY_SOURCE=2 -g -O2 "</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">export FLG2="</span><span style="font-family: 'Courier New', Courier, monospace;">-fstack-protector </span><span style="font-family: 'Courier New', Courier, monospace;">--param=ssp-buffer-size=4"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">export FLG3="</span><span style="font-family: 'Courier New', Courier, monospace;">-Wformat -Werror=format-security</span><span style="font-family: 'Courier New', Courier, monospace;">"</span><br />
<span style="font-family: Courier New, Courier, monospace;">./Configure -des -Dcc=gcc-4.7 -Uinstallusrbinperl \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Ulocincpth= </span><span style="font-family: 'Courier New', Courier, monospace;">-Uloclibpth= -Uafs -Ud_csh -Ud_ualarm \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> -Uusesfio -Uusenm -Ui_libutil \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dccflags="${FLG1} </span><span style="font-family: 'Courier New', Courier, monospace;">${FLG2} </span><span style="font-family: 'Courier New', Courier, monospace;">${FLG3}</span><span style="font-family: 'Courier New', Courier, monospace;">" \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dldflags=" -Wl,-z,relro" \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dlddlflags="-shared -Wl,-z,relro" -Dcccdlflags="-fPIC" \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Darchname=arm-linux-gnueabihf -Duseithreads \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dusethreads -Duselargefiles </span><span style="font-family: 'Courier New', Courier, monospace;">-Dusesitecustomize \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> -Duse64bitint -Doptimize=-O2 -DDEBUGGING=-g \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dprefix=${RASPBPREFIX} -Dprivlib=${RASPBPREFIX}/lib \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Darchlib=${RASPBPREFIX}/lib \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dsiteprefix=${RASPBPREFIX}/site \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dsitelib=${RASPBPREFIX}/site/lib \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dsitearch=${RASPBPREFIX}/site/lib \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dvendorprefix=${RASPBPREFIX}/vendor \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dvendorlib=${RASPBPREFIX}/vendor/lib \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dvendorarch=${RASPBPREFIX}/vendor/lib -Dsed=/bin/sed \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> -Dpager=/usr/bin/sensible-pager -Duseshrplib </span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
I added some basic CPAN modules<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">export PATH=/var/local/xperl/site/bin:/var/local/xperl/bin:$PATH</span><br />
<span style="font-family: Courier New, Courier, monospace;">cpan -i LWP::UserAgent</span><br />
<span style="font-family: Courier New, Courier, monospace;">cpan -i ExtUtils::XSpp</span><br />
<br />
Then I needed the development libraries required to build wxWidgets.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install libgtk2.0-dev libgstreamer0.10-dev \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> libgstreamer-plugins-base0.10-dev libglu1-mesa-dev \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> libexpat1-dev </span><span style="font-family: 'Courier New', Courier, monospace;">libtiff4-dev </span><span style="font-family: 'Courier New', Courier, monospace;">libpng12-dev \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> libjpeg-dev </span><span style="font-family: 'Courier New', Courier, monospace;">libcairo2-dev </span><span style="font-family: 'Courier New', Courier, monospace;">libxmu-dev</span><br />
<br />
I'm not sure if it matters, but I wanted wxWidgets built with the same gcc as Perl uses so I downloaded the Alien::wxWidgets tarball and built with<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">perl Build.PL \</span><br />
<span style="font-family: Courier New, Courier, monospace;"> --wxWidgets-extraflags="CC=gcc-4.7 CXX=g++-4.7 LD=g++-4.7"</span><br />
<br />
Requested a download and build of wxWidgets 2.9.4 when prompted.<br />
<br />
Then it was back to the cpan client in a graphical environment for the Wx builds.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">startx</span><br />
<br />
Open an LXTerminal and<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">export PATH=/var/local/xperl/site/bin:/var/local/xperl/bin:$PATH</span><br />
<span style="font-family: Courier New, Courier, monospace;">cpan -i Wx</span><br />
<span style="font-family: Courier New, Courier, monospace;">cpan -i Wx::Demo</span><br />
<br />
I hope it all helps anyone interested to get started.</div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-6864204428566427640.post-47785439840408853262012-11-06T19:16:00.000+00:002012-11-07T23:01:12.965+00:00Fun Things Still HappenAt the end of last week I came across the <a href="http://www.raspberrypi.org/" target="_blank">Raspberry Pi</a> project. The Raspberry Pi Foundation developed this little device to encourage people to learn to tinker with computing, both in software and hardware. The exciting bit from a hardware point of view is that the board has 26 GPIO pins. ( Pins that can be programmed to do stuff. ). The boards cost around $35.<br />
<br />
The foundation is supporting Python as the official educational language. It looked like too much fun to be left to Python to me, so I did some preliminary investigation about support for Perl. If this thing turns out to be popular it would be nice if educational users were exposed to Perl on it.<br />
<br />
The first thing to check was that programming the GPIO is possible in Perl and sure enough , <a href="http://search.cpan.org/~mikem/Device-BCM2835-1.3/lib/Device/BCM2835.pm" target="_blank">Device::BCM2835</a> is available on CPAN.<br />
<br />
The board is an ARM based device with 512mb of RAM using SD cards for storage. But how can I have a play before actually purchasing a board?<br />
<br />
The Raspberry Pi foundation provides a 2gb disk image of 'Raspbian' - a Debian - Wheezy based Linux distribution compiled for the Raspberry Pi. The idea is that you download the image and write it to an SD card. The Raspberry Pi supports a 32GB SD card so I would guess that in practice you would write the image to that and resize the partitions to take up the additional space.<br />
<br />
I wanted to find out if I could run Raspbian in a Qemu emulated ARM environment on Windows to do some initial playing around with. It turns out that you can. Some Googling and use of virtual disk tools on Linux got me a 32GB Raspbian image that I can load as the root partition of a Qemu ARM environment on Windows with 256mb of RAM. As the memory of a real 512mb Raspberry Pi doesn't all go to the ARM processor, this environment seems a reasonable emulation for some initial playing.<br />
<br />
This is screenshot of the Wx::Demo for wxPerl running in my Raspbian on Qemu.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFZ4vFgtFeigsKsnPkk7pMfu4aK_XP43wstBK0nCYv76Jos3lSfGUIM3xINNKzCs3HrhaCWg9NnqkrRCKqPlu6GfS4Z2jV5sKQ7rzigIbLAXYRLc_MqTtWWcVlFvYmaCHalaBBp0c4XQA/s1600/raspbian.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="497" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFZ4vFgtFeigsKsnPkk7pMfu4aK_XP43wstBK0nCYv76Jos3lSfGUIM3xINNKzCs3HrhaCWg9NnqkrRCKqPlu6GfS4Z2jV5sKQ7rzigIbLAXYRLc_MqTtWWcVlFvYmaCHalaBBp0c4XQA/s640/raspbian.png" width="640" /></a></div>
<br />
<br />
So now I await delivery of a board whilst dreaming about what to do via those GPIO pins. ( in Perl, of course )<br />
<br />Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-6864204428566427640.post-59927854092959097402012-09-04T23:51:00.000+01:002012-09-04T23:55:50.488+01:00PPMs for latest Wx rolling out.After a gap approaching 11 months the<a href="http://www.wxperl.co.uk/" target="_blank"> wxPerl site for Wx</a> related PPMs is being refreshed with the latest versions of Wx and supporting modules.<br />
<br />
I've included Perl 5.8 and 5.10 in the builds as it turned out to be not much extra work so now PPMs are available for ActivePerl 5.8 through 5.16.<br />
<br />
If you have not taken a look at Wx for a while it may be worth a return visit. In particular the availability of an up to date Wx::PdfDocument is an interesting useful addition with extensive example code included for Wx::Demo.<br />
<br />
Current users might also like to try modules built against the latest release of wxWidgets 2.9.4 by pointing the PPM client at the <a href="http://www.wxperl.co.uk/repo29" target="_blank">development repository</a>.<br />
<br />
PPMs for MS Windows 64 and 32 bit are currently available. Linux and Mac OSX builds will be uploaded soon.<br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6864204428566427640.post-1027221645819707932012-08-31T12:26:00.001+01:002012-08-31T12:27:11.770+01:00Launching Documents in WxWhilst working on the port of C++ example code for <a href="http://search.cpan.org/search?query=Wx%3A%3APdfDocument&mode=all" target="_blank">Wx::PdfDocument</a> I came across a simple cross-platform way to launch documents from Wx applications.<br />
<br />
The necessary functions and methods have been supported in Wx for some time but I have not come across usage in wxPerl.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">.....</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">my $docpath = '/path/to/somefile.pdf';</span><br />
<span style="font-family: Courier New, Courier, monospace;">my $docext = 'pdf';</span><br />
<span style="font-family: Courier New, Courier, monospace;">{</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;"> my $manager = Wx::MimeTypesManager->new();</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if( my $filetype = $manager ->GetFileTypeFromExtension($docext) ) {</span><br />
<span style="font-family: Courier New, Courier, monospace;"> my $cmd = $filetype->GetOpenCommand($docpath);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> Wx::ExecuteCommand($cmd);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> } else {</span><br />
<span style="font-family: Courier New, Courier, monospace;"> Wx::LogError(qq(Could not find application for file type $docext));</span><br />
<span style="font-family: Courier New, Courier, monospace;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">.....</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: inherit;">It's simple, it works and it's one of my favourite snippets.</span><br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6864204428566427640.post-45385114739420733122012-08-31T12:01:00.001+01:002012-08-31T12:06:50.029+01:00Citrus Perl 5.16.1 ReleasedCitrus Perl 5.16.1 has been released bringing the latest Perl and Wx together in a binary distribution. On Windows, Linux and Mac OSX downloads including Wx built against both wxWidgets 2.8.12 and 2.9.4 are available.<br />
<br />
<a href="http://www.citrusperl.com/download.html" target="_blank">Citrus Perl Downloads</a><br />
<br />
Mac OSX Mountain Lion is now also supported.<br />
<br />Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-6864204428566427640.post-30888432303642948642012-04-20T04:24:00.000+01:002012-04-20T04:24:37.914+01:00Release testing? We don't need no release testing.A schoolboy error not completing the pre-release testing for the latest Citrus Perl resulted in me inflicting broken Windows releases on a few folks.<br />
<br />
Release 14a fixes the problems.<br />
<br />
Probably...Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6864204428566427640.post-45984087457009943832012-04-19T12:28:00.001+01:002012-04-19T12:29:20.647+01:00New Citrus Perl keeping ahead of the $->MainLoopI've been putting some effort into improving the user experience when installing and using <a href="http://www.citrusperl.com/" target="_blank">Citrus Perl</a> and I've taken the opportunity to add a couple of features that may make the distributions more attractive as a platform for application distribution.<br />
<br />
The latest releases also come in two flavours with wxWidgets 2.8.12 stable or development wxWidgets 2.9.3. It is probably time for existing users of wxPerl to think about looking how their code works under the development version and also time to take a look at the many new features and controls in the development version.<br />
<br />
First time users should probably stick with the stable version for now. There are still one or two issues with 2.9.3 that could leave a new user scratching their head wondering why oh why the code doesn't work like the docs say.<br />
<br />
It is a distribution to support GUI development in the main so it has, at last, grown some GUI tools and installation methods.<br />
<br />
A Citrus Utilities Application helps you set up ( relocate ) Perl and carry out some platform specific tasks.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigEWdSZ61vTwZJYuyLVbqGuuISOAV8g-qbp-5OFOJ8_hNeMjj1UBnMbv3foAdxbHCrg7Pg4L11SKbz2ogaw1nRZy3_8QdtwlKeZ5p3zWjK2h3nUw_q3BpUVTEk7mvpJRnpSnHuip_USxw/s1600/manage.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="318" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigEWdSZ61vTwZJYuyLVbqGuuISOAV8g-qbp-5OFOJ8_hNeMjj1UBnMbv3foAdxbHCrg7Pg4L11SKbz2ogaw1nRZy3_8QdtwlKeZ5p3zWjK2h3nUw_q3BpUVTEk7mvpJRnpSnHuip_USxw/s400/manage.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Citrus Utilities Management Tab</td></tr>
</tbody></table><br />
Citrus Perl also allows you to create new distributions. To make this more obvious and simpler to do, this feature gets a tab in the utilities application too. All the essential stuff is covered like "What shall I call it?" and "Can I have my own splash logo?". As an added bonus it actually works too.<br />
<br />
This is, I think, a particularly interesting feature if you wanted to put together a distribution of something like BioPerl and your end users would not be able to successfully put together all the dependencies themselves.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIBo0Mv-J55BdBG9NKvLNQwdb4iK-telcLii6NT2K54tKuymIzbJXoMK41M-dt9-lW01ZELZWs3htAStNzZZ3oe1mItBjNNSoMPjOA8zCS9EgDkbEEfJKpoQG6nBRMGMsloUGommeL8vU/s1600/distribution.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="338" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIBo0Mv-J55BdBG9NKvLNQwdb4iK-telcLii6NT2K54tKuymIzbJXoMK41M-dt9-lW01ZELZWs3htAStNzZZ3oe1mItBjNNSoMPjOA8zCS9EgDkbEEfJKpoQG6nBRMGMsloUGommeL8vU/s400/distribution.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Citrus Utilities Distribution Tab</td></tr>
</tbody></table><br />
And finally on the feature front, if you feel that your end users should be able to point and click everything, the utilities app will create dependent executables for you that you can ship and relocate with your custom distribution.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXACZCSgS2kLv3o3yarTbBJZSfIFiZkTVLuYkMyw65kjZzTAlQa4Oc9Cvef4rk_sMKoydC3Iglg-1dxN0JGnkBh7Y0TuYn_DRTa83bIsdYE44-Za32vFPmXUEO0hxcYUlqTl6PDceWdYI/s1600/exec.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="355" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXACZCSgS2kLv3o3yarTbBJZSfIFiZkTVLuYkMyw65kjZzTAlQa4Oc9Cvef4rk_sMKoydC3Iglg-1dxN0JGnkBh7Y0TuYn_DRTa83bIsdYE44-Za32vFPmXUEO0hxcYUlqTl6PDceWdYI/s400/exec.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Citrus Utilities Executable Tab</td></tr>
</tbody></table><br />
I haven't got around to adding features for creating desktop and application menu icons yet - but the code's open and has a hook already for a post installation script so you can always write this yourself.<br />
<br />
As always, the distributions include Tk to help Tk applications developers with migration of code to wxPerl. It really is time you all did this :-)<br />
<br />
The Utilities Application works with a set of modules I've called "CP::Wx" which is showing mild signs of developing into a sort of mini Wx framework.<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">my $obj = CP::Wx::Widget->new($prnt, style => wxSTYLE_I_WANT);</span><br />
<br />
is something I've been wanting to do for a while.<br />
<br />
Full source for everything is included in the distribution so you can stare aghast at the quality of code I'm willing to distribute.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6864204428566427640.post-34389113042886949592012-03-13T12:43:00.002+00:002012-03-13T13:22:39.605+00:00A MinGW for PerlI have been compiling 32 bit and 64 bit versions of mingw-w64 for use in <a href="http://www.citrusperl.com/">Citrus Perl</a> and since November 2011 the compiler distribution has been available separately from <a href="http://sourceforge.net/projects/perlmingw/files/">Citrus MinGW</a>.<br />
<br />
As mingw-w64 does not really have an official binary release I thought it would be useful to have a distribution put together with Perl users in mind.<br />
<br />
Included in the distribution is a config file that makes use with ActivePerl simple - just set PERL5OPT=-MConfig_MinGWFP.<br />
<br />
The binary distribution is contained in a single archive and includes gfortran in addition to gcc and g++.<br />
<br />
In addition to the binaries, there's a full environment for building the compilers from source if you really want to. There are just four 7-zipped files to download and two commands to build the whole thing.<br />
<br />
I hope it proves useful.<br />
<br />
Regards<br />
<br />
MarkUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-6864204428566427640.post-75603431921745982392011-09-26T21:49:00.000+01:002011-09-26T21:49:47.000+01:00Packaging Perl ApplicationsFor some time I've been involved with development for <a href="http://www.cavapackager.com/">Cava Packager</a>, a tool to package and deploy applications written in Perl.<br />
<br />
The project originally grew out of frustration encountered packaging wxPerl based applications where the existing options didn't quite fit my requirement. The project has been through a few incarnations from a purely MS Windows 'free' to use application to a commercially licensed version supporting MS Windows, Linux and Mac OS X.<br />
<br />
The latest release has re-adopted the original 'free use' model. Commercial level support is still available separately, but we have separated commercial support from usage and licensing entirely.<br />
<br />
Cava Packager does remain closed source and so is 'free beer' without usage restriction.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6864204428566427640.post-39900069824877812822011-08-22T23:24:00.000+01:002011-08-22T23:24:23.040+01:00Citrus Perl - create your own binary distributionsCitrus Perl is a binary distribution of Perl (Currenly 5.12) for Windows, Linux and Mac OS X. The primary aim of the distribution is to provide a standard platform for building and distributing Wx based applications. It also contains builds of several other modules including DBD::Pg, DBD::mysql, DBD::SQlite, TK, GD and GD::Graph.<br />
<br />
The latest release (8) allows you to create your own distribution containing any extra modules you have installed.<br />
<br />
Citrus Perl attempts to provide one solution to the problem of:<br />
<br />
A) A desirable way to distribute a Perl application is to install Perl,<br />
B) It can be quite difficult to get a standard and predictable build of modules such as Wx, GD and DBD::Pg across Windows, Linux and Mac OS X.<br />
<br />
The entire distribution is released under the same Artistic License as the distributed Perl with the exception of external libraries and tools ( libmysql, libpq, mingw toolchain etc.) that carry their own licence terms.<br />
<br />
<a href="http://www.citrusperl.com/">Citrus Perl Information and Download</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6864204428566427640.post-7092249736897185192011-06-28T11:02:00.000+01:002011-06-28T11:09:00.715+01:00Perl5 v Perl6 - again.It seems that a new bout of Perl5 vs Perl6 is running its course again. I won't add links as the number of blogs, posts, tweets and general opinions has now exceeded the number where I can remember who said what and which bits I agreed with.<br />
<br />
Sometimes I am very slow to recognise the obvious - and this is a case in point. The Perl5 vs Perl6 discussion nearly always runs on from or is part of a 'why don't people use Perl' lament. Lots of reasons are put forward, invariably without any real evidence base. That's because, of course, we don't really have the means to gather the evidence. So at best we have to rely on the anecdotal observations of our fellow users of Perl to weight our own opinions. Or maybe we are arrogant enough to be certain that we alone have determined the one true explanation. We all do this sometimes.<br />
<br />
So, in this spirit, I'll add my own dash of grist to the mill as the current lament grinds down to the usual unsatisfactory conclusions.<br />
<br />
The fact that Perl is not considered for many projects has nothing to do with the features offered by the language or some perceived confusion over Perl5 vs Perl6. Perl has no obvious coherent set of tools for building, testing, deploying and managing your project or application in a reasonable way. Perl being Perl I have no doubt that someone will point me to a selection of modules and approaches that allow this but that, I feel, misses the point. The selection would be the personal choice of a seasoned developer. Knowing how to achieve something is not the same as having a de-facto toolkit.<br />
<br />
No-one develops deployable applications in .NET or Java using a text editor and some hand crafted helper scripts. I'm not sure what the Python folks use and perhaps I should find out. But my general point is that when people discuss the selection of a language for a project, they are really selecting a 'platform' that includes the whole development and maintenance environment.<br />
<br />
The thing that I have been slow to recognise is that there has been a project running for quite some time that attempts to start building a modern working environment for Perl. That is <a href="http://padre.perlide.org/">Padre</a>. Padre is not just an editor or a graphical debugger, though those two components are essentials. It offers the chance to build a coherent toolkit for managing a project that uses Perl as a language. The future of Perl as a common viable alternative for general application development rests with Padre or son of Padre . Bringing the benefits of modern Perl5 and next generation Perl6 to a wider audience.Unknownnoreply@blogger.com7tag:blogger.com,1999:blog-6864204428566427640.post-51628161845466062322011-06-24T17:09:00.000+01:002011-06-24T17:14:24.619+01:00Wallasey Does Perl GUI DevelopmentIt is my first blog post here and I should give a little information about myself. I have a commercial connection to <a href="http://www.cavapackager.com/">Cava Packager</a>, a tool for packaging and distributing Perl applications. I chip in with some contributions to Mattia Barbon's <a href="http://wxperl.sourceforge.net/">wxPerl</a>. I am involved with the maintenance of <a href="http://www.citrusperl.com/">Citrus Perl</a>, a binary distribution of Perl intended for GUI application development. I also maintain a PPM repository for wxPerl related modules for the ActivePerl user community at <a href="http://www.wxperl.co.uk/">wxPerl PPMs</a>. I occasionally lurk on IRC channels as 'wallasey'.<br />
<br />
Given all of the above you might be surprised to learn that I don't actually like GUI programming. I've worked on projects with a GUI element involved but near the top of my design goals list was always a proper separation of any GUI elements. Apart from being practically useful and beneficial this also meant I could hand off GUI development to a separate team or individual with more talent and enthusiasm in that area. A win win situation.<br />
<br />
Personally I find GUI design and development hugely unrewarding. The level of effort required to translate a requirement to working code seems totally disproportionate to me. I know what I want, the end user knows what they want, and I'm happy that the two things are roughly the same. It always seems to me that translating that into code takes an inordinate amount of time which could be better spent doing interesting things with the 'real' application work.<br />
<br />
This view is however, tempered by experience. There are great GUI designers and developers who actually enjoy translating complex interactions into simple and enjoyable end user experiences. Take the example of a command line utility with say 20 different possible options, with each option taking several possible values. You might call it as:<br />
<br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">mycommand --opt1=a --opt2=b --opt3=25 --opt4=g --opt5=k</span> </span><br />
<br />
That seems totally reasonable to me. If it is useful I don't mind learning all the options. It seems the natural thing to do. However, this possibly represents a huge amount of wasted effort on the part of all the users of <i>mycommand</i>. If you asked a room of developers to each provide a GUI for <i>mycommand</i>, you would get a large number of implementations which just gave you option choices to select. Probably from me too. The important thing is what <i>mycommand </i>actually does, and the GUI is just eye candy, right?<br />
<br />
Well, no. I'd contend this can be very wrong. A GUI backed by great design removes the need for the user to understand the implementation. It asks the user what they want to do, not how they want to interact with the underlying implementation. Great GUI design does happen and when it does it translates complex operations into simple end user interactions.<br />
<br />
I would say that often, the people who understand how to implement systems to handle the complex operations robustly are not the people who can create and implement great GUI designs. GUI development in Perl has the flavour of a niche in a niche. Almost a minor interest hobby for Perl developers.<br />
<br />
Why?<br />
<br />
Ask about tools for cross platform GUI development and generally you'll get back 'Java with Eclipse'. You may get a mention of QT and perhaps wxWidgets for C++. From the end user perspective - that is the user experience of applications built using these tool - I don't think there's a great deal of difference. wxWidgets looks most native to me. Java looks 'Java' - to me at least, but maybe I'm looking for it.<br />
<br />
Mattia Barbon's wxPerl is a great technical implementation of a Perl wrapper for wxWidgets. I always consider the design approach really smart. The API presented to the Perl user follows the C++ API as closely as possible. This provides you with two main advantages. The minimum abstraction from the underlying wxWidgets API makes maintenance viable for an open source project maintained largely by 1 person. The C++ API documentation is directly usable as documentation for the Perl API. I also find some of the internal implementation of wxPerl quite spectacularly clever. It is quite simply, awesome.<br />
<br />
So Perl, the most cross platform of cross platform languages has a great GUI toolkit at its disposal but it gets little use in GUI development. There may be great GUI designers who also use Perl but there seems to be very few who engage in both activities at the same time.<br />
<br />
Consider <a href="http://padre.perlide.org/">Padre</a>, probably the most widely known wxPerl application. From following the Padre mailing list and occasional visits to the Padre IRC channel, I think the difficulties experienced by the active Padre developers who are both talented and skilled expose some fundamental problems creating a GUI in Perl.<br />
<br />
It is always dangerous and to assume you understand someone's opinion and experiences from a few comments on mailing lists and IRC. However, I get the impression that the general feeling within the main contributors to Padre is that they want to get on and do great things but are hampered because the level of effort required to translate a GUI requirement into working GUI code seems totally disproportionate.<br />
<br />
And that is, I would say, the core of the problem regarding GUI development in Perl. It doesn't attract many people whose primary interest is GUI design and development. It just attracts people whose primary interest is Perl. Like myself, these users see the benefit and flexibility of<br />
<br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">mycommand --opt1=a --opt2=b --opt3=25 --opt4=g --opt5=k</span></span><span class="Apple-style-span" style="font-size: x-small;"> </span><br />
<span class="Apple-style-span" style="font-size: x-small;"><br />
</span><br />
Once you are fully conversant with <i>mycommand's </i>options, and how they all work together there seems no motivation to work on a GUI to replace <i>mycommand </i>? And for your own usage, there isn't. But if you have a notion of making the power of Perl available generally to GUI designers and developers, you need tools that abstract the underlying implementation almost completely.<br />
<br />
wxPerl needs a decent application design environment to abstract its own '<i>mycommand</i>' syntax. One that requires no knowledge of Perl to create your first 'Hello World' application. The basic options available to you when starting the GUI elements of your design should be available on a '<i>do what I want</i>' basis. Select your application options - say threaded / none threaded, your help editor, and the platforms you want to target - design your first form by drawing it. Select it as your 'startup' form - and run.<br />
<br />
It won't do much as you need to write event handlers in Perl - so at that point you can feel smug with yourself followed by reading the 'Application Basics' and 'Event Handler' tutorial in the manual - possibly via some Perl manuals if it is your first experience of the language.<br />
<br />
Of course, this means being prescriptive about a great many things in the overall application design. But you need that to give new users the helping lift they need when first starting.<br />
<br />
Perhaps those who have spent months or even years reinventing the wheel with our own wxPerl applications should consider how we can put the power of a wxPerl GUI in the hands of those who currently would not consider it. Take the hard won lessons from Padre, mix them with a bit of experience from elsewhere to produce the first Wx application design tool in Perl. Then developers who are better at that sort of thing can jump in and start improving it. Perhaps if we build it they will come.<br />
<br />
It'll mean I have some chance of handing off my GUI design and development to someone else and we can both get on with doing the sort of work we enjoy most.Unknownnoreply@blogger.com4