5 resources for learning Perl Graphical Programming

Posted June 1st, 2009 by kaikokan

As I'm trying to learn perl, and I'm trying to learn perl GUI programming in the process I've been browsing the internet for information. I've chosen perl-Gtk as the GUI framework for the start of this journey, there are some arguments against this choice as readers commented in previous articles, but I'm happy with it. It feels like this is the right way of learning for me, the perl programming language is pretty easy to learn (the basics at least) and it's very forgiving (downsides to that too, I know) and perl-Gtk is very nice as it makes it possible to create GUI interfaces very quickly without too much technical knowledge.

Getting together information

The only problem I encountered at first is getting together the information to know exactly what to use and how to use it. I started by reading the sources for some programs I found on my system and debugging them to learn the way they are processed. This was a great learning experience, my knowledge has quickly expanded by doing this. Still there were some important things I really needed to help me trough the learning process. I needed good reference material, examples and a book.

Sadly enough there doesn't seem to be any printed book about perl-Gtk, luckily I did find some great tutorials on the perl-Gtk site. I also found some other helpful tools and resources by accident.

List of resources

I've decided to create a little list of resources I found until now

1. podviewer

This is what I started out with I found the podviewer tool on my system (ubuntu) it is based on the podviewer module. It is not specific to Gtk but it does make use of Gtk for the GUI part. The podviewer is a graphical utility to show perl documentation for the modules on your system. It has basic functionality and is a great resource for learning as it is reasonably simple but functional software and as it is perl it is not compiled so the source is readable. The only downside to this tool is that you need to know the name for the module you want to read about.

podviewer is installed with Gtk2::Ex::PodViewer so if you install the PodViewer module with CPAN I guess you get the podviewer together with it.

2. podbrowser

While reading the documentation for the podviewer I found there's a much more useful application called podbrowser. The podbrowser is a much more complex app which makes it less useful for learning from it by reading the source. But it is a great tool for browsing trough the perl documentation available on the system and it also provides a possibility of searching CPAN if the pod for a requested module wasn't found.
The podbrowser shows an index, search functionality, bookmarking option, tree view, document tree, anything I could think of I missed in the podviewer (and the rest I didn't even know I was missing)
If you, like me are learning perl this is a great reference tool showing the documentation for the available modules. This was just what I needed. Again not Gtk specific but very nice if you are new to perl.

Get the podbrowser here: http://freshmeat.net/projects/podbrowser/

3. tutorials and online books

There are some great tutorials at the perl-gtk site :

http://gtk2-perl.sourceforge.net/doc/

Especially the study guide: http://forgeftp.novell.com//gtk2-perl-study/homepage/
Was very useful to me. This provides a very easy to read book about Gtk-perl, a great place to start with nice examples of working code. And a BIG bonus in this document is the description of how to read the documentation for the Gtk modules. Very helpful information as the documentation can be a bit daunting at first for starting users like me. This is chapter 3 of the book.

and the tutorial (alpha version)
http://gtk2-perl.sourceforge.net/doc/gtk2-perl-tut/ is nice too.

4. Example code

I found a great bunch of example code here:

The gtk-perl-demo at
http://szabgab.com/gtk2.html

I believe most of this code comes from the standard perl-Gtk distribution. I couldn't find it on my system though. Just unpack the tar and run the examples. There's a script called gtk-perl-demo.pl in the file, running this gives a GUI interface providing an index into tutorials, examples and a cookbook available.
It provides search functionality and lots of interesting examples which can be run from the program as well as edited and saved from within the interface. Furthermore there's a directory gtk-demo which contains more example code and a main.pl running this provides a graphical widget index. It's a great show of possibilities. This is very useful for learning which widget is right for which job. It surprised me to see what functionality was included in the text widget which I have used for the example in my previous article. It's very easy to add all kinds of text formatting and even animation to the buffer.

5. Object browser

There are also 2 object broser programs available which give a hierarchical tree view of the modules with Glib as root. On my system this provided to be a little buggy and I couldn't add namespaces. Maybe you have more luck with this.

http://asofyet.org/muppet/software/gtk2-perl/object_browser-0.006

http://asofyet.org/muppet/software/gtk2-perl/object_browser-methodscraper

If you know more/better resources for learning GUI perl (especially Gtk for now) please leave a comment.
It can take a while before comments get published.

This is the fifth article in a ongoing series about learning perl GUI programming. You may be interested in the other articles too. You can find the other articles here:
1. starting perl GUI programming
2. Installing Eclipse, the Epic Perl plugin and my first Perl GUI program
3. Open Source rocks! Learning from code by debugging
4. Quick and dirty linux GUI programming
5. resources for learning Perl Graphical Programming
6. Drawing and animating directly to the Desktop with Perl
7. Dynamically-creating-gui-objects-on-demand-in-Perl


Dissent

Anonymous 1 year 9 weeks 4 days 8 hours ago

Whenever I have free time I try to read either periodical or blog articles (it is possible to find much interesting with the help of pdf search engine. Thus, thank you for your being here and for your great posts.