Guiding Fate
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.
GUIDeFATE
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 |
+M-----------------------------------------------------------------------------+
|+T------------------------------------++I------------------------------------+|
||text editor ||plot.png ||
|| || ||
|| || ||
|| || ||
|| || ||
|| || ||
|| || ||
|| || ||
|+-------------------------------------++-------------------------------------+|
| |
+------------------------------------------------------------------------------+
Menu
-File
--New
--Open
--Save
--Quit
-Chart
--Plot
--Save As
END
GUIDeFATE::convert($window, "v");
my $gui=GUIDeFATE->new();
$gui->MainLoop;
Adding a few more bits of gnuplot piping yields a functioning graphical interface to gnuplot...
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:
- 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
- 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.
- 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...
At this point I would:
1) CPAN it. As is. That gives you exposure which will bring in Pull Requests so you don't have to do everything.
2) Once CPAN'ed I would add in support for Tk - that's the easiest toolkit to install in the Perl world, as far as I know. That will make you have to re-architect a bit, but now's the time before the thing gets too big.
Thanks Matthew, I will try and put it up this weekend. I figured I would need to put in tests etc and write a decent pod. TBH I am not entirely sure of the process.
Regarding TK, this was my thought too and probably the easiest, though I count entirely on online tutorials. I will try and simultaneously do Gtk, hopefully by following weekend.
Welcome to the CPAN world, Saif. Please drop me a line, if you need any assistance.
@Mohammad Thanks for your support mate, and nice to have met you at LPW.
@Saif, I noticed you released your work to public domain, congratulations. I wonder if you have any plan to share your code on GitHub. This would help others to contribute and make it even more useful.
@Mohammad, It's already there mate... saiftynet/GUIDeFATE.