February 2018 Archives

Guiding Fate


Somebody once said, that the power of a programming language is not what it lets you do, but what it lets you do easily. Might be Larry himself who said it, not sure, but I heard it at the London Perl Workshop. I started learning Perl from an old second hand book I found in a charity shop a few years ago. I can't say I am any good at it. While previously I could find lots of resources available, these are increasingly harder to find, more outdated, and less able to address modern use cases. Some folk even suggest it is terminal decline. It would be a pity. It is a powerful language, and using it for me has given me a daily discovery for some feature that I didn't know, and exposed me to a large number of clever folk who can bring a different angle to a problem you have struggling with. To my mind it reflects the versatility of a language that has more than one way to to anything.

I guess that leaves us a few choices. One may be to learn a different language, deserting an old faithful friend for something more modern and youthful. Another may be to just hang around the old meeting grounds, reminiscing about the good old days, tapping the bar with the calloused fingertips, mumbling about hashes and sigils, and talking about how they don't make programming languages like they used to. Yet another may be to prove that anything that can be done by those young whippersnapper python and go programmers can be done in Perl, easier, quicker and more intelligently. Of course we all know it can be done, but many of us stopped believing it...and there starts the downwards spiral. Kismet, as Nelson said.

The only way to reverse this is a steady stream of evidence that makes Perl useful and accessible to everyone.


Ultimately the product of a programming effort must exceed the effort required to achieve it, not just in terms of actual yield, but the appearance of that yield. As I say, I know I am not a skilled programmer. But GUIDeFATE is an attempt at making programming a GUI application easier. It just uses the power of Perl in text manipulation and converts a textual representation into a quick and easy to use interface with the potential for multiple target backends. It is still a work in progress (only started a couple of weeks ago). But how is this for a quick and dirty GUI text editor and function plotter? Without knowing much about GUIs?

Designing the interface required nothing more than the ability to use the simplest text editor.

#!/usr/bin/env perl 
#A test script that crtaes a minimalist gui gnuplot
#use GUIDeFATE (which in turn depends on Wx)
#needs gnuplot to be installed

use strict;
use warnings;
use GUIDeFATE qw<$frame>;

#This string contains the definition of the interface
my $window=<<END;
|T  Test GnuPlot                                                               |
||text editor                          ||plot.png                             ||
||                                     ||                                     ||
||                                     ||                                     ||
||                                     ||                                     ||
||                                     ||                                     ||
||                                     ||                                     ||
||                                     ||                                     ||
||                                     ||                                     ||
|                                                                              |

--Save As


GUIDeFATE::convert($window, "v");
my $gui=GUIDeFATE->new();

Adding a few more bits of gnuplot piping yields a functioning graphical interface to gnuplot... GUIGnuplot.png

What next?

As I have developed this it is clear that while exciting and potentially very helpful, there are many things that need to be considered form this time on:

  1. Entry to CPAN : This is not yet, I feel, ready. Nor am I exactly sure how this should be done. I am working on it though
  2. It is clear that many potential users have difficulty on installing wx on which the current iteration depends, (although eventually GUIDeFATE will support multiple back ends) I need to know which will the best target that will benefit the most people.
  3. I will be adding bits to the interface, of course. It would be useful to know what other people would find useful.

My difficulty would be picking what to do next...

About Saif

user-pic An Orthopaedic Surgeon, A Tissue Engineering Scientist, Lecturer, (and Hobbyist Programmer, Electronics Engineer and Roboticist)