Sometimes asking nicely works… August 24, 2009
Posted by claudio in Perl, Programming.Tags: android, google, Perl
2 comments
Andy Lester was the first to point out that the we will have Perl support on the next release of Android! I guess asking nicely, does help.
I am not saying they listen to me, but I asked as well. ![]()
Install DBD::mysql for Solaris 10 system perl August 13, 2009
Posted by claudio in Perl, Solaris, UNIX.Tags: DBD::mysql, Mysql, Perl, Solaris, Solaris 10, UNIX
add a comment
Installing DBD::mysql on Solaris 10 seems to be less trivial than “cpan DBD::mysql” when you want to use the system-supplied perl (5.8.4) and mysql (4.0.31) installation. Google shows a lot of people asking how to proceed, but surprisingly no answers. Typically, one gets this error at make time:
[...]
"dbdimp.c", line 4468: improper member use: com
"dbdimp.c", line 4468: improper member use: com
"dbdimp.c", line 4468: improper member use: com
"dbdimp.c", line 4630: undefined struct/union member: pmysql
"dbdimp.c", line 4653: undefined struct/union member: pmysql
cc: acomp failed for dbdimp.c
make: *** [dbdimp.o] Error 1
To install the module do this:
- Install the following Solaris mysql packages (if not already installed): SUNWmysqlr, SUNWmysqlu, SUNWmysqlS, SUNWmysqlt.
- Type the following as root:
cd /usr/sfw/share/src/mysql
./configure - Download the tar ball of the modules or, easier, go to your cpan build directory (set at cpan configure time), typically at ~/.cpan/build/DBD-mysql-<VERSION> (already there if you previously tried to install the module with cpan).
- Run the makefile with the following arguments (adapt to your own needs if necessary):
cd ~/.cpan/build/DBD-mysql-<VERSION>
perl Makefile.PL --libs '-R/usr/sfw/lib -R/usr/sfw/lib/mysql -L/usr/sfw/lib -L/usr/sfw/lib/mysql -lmysqlclient -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm' --cflags '-I/usr/sfw/include -I/usr/include -I/usr/sfw/share/src/mysql/include'Installing /usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBD/mysql/mysql - Complete the normal installation (make, make test (if you have a test db running), make install).
That’s it.
Some ideas on method auto-completion in Padre June 9, 2009
Posted by claudio in Perl, Programming.Tags: eclipse, epic, komode edit, netbeans, Padre, Perl, Programming
12 comments
Auto-completion is a nice feature for an IDE. While Padre supports some auto-completion functions, method auto-completion is an important missing feature. This post is a short round-up of features present in other IDEs.
What auto-completion features does Padre support today?
Beside automatic bracket completion, Padre has a nice auto-completion implementation for variables (first character -including sigil- then ctrl + p):

Eclipse + Epic
Epic (an add-on to Eclipse) has a nice working auto-completion feature activated by the method invocator (->).

As a reference, the java auto-completion in Eclipse:

Komodo Edit
Komodo Edit also has auto-completion for methods, but does not show those inherited from parent classes making the feature rather useless for OO development.

Netbeans
Netbeans has no Perl support, nevertheless the java auto-completion feature is a good example:

The method auto-completion feature is activated by the “.” (“->” in Perl). Not only you get a list of accessible methods (with expected parameter type and return value), but also the javadoc documentation for the selected method.
How should Padre support method auto-completion? Some ideas
- Method autocomplete should be activated by “->” and “::”. This way class hierarchies can be autocompleted as well. With “::” support for functions can be added.
- Private methods should be hidden. By convention, private methods start with “_”.
- Linking method autocomplete to perldoc is a winner combination when programming to not yet familiar APIs and certainly friendly to new Perl developers. While Perl is not strictly typed, a well formatted perldoc entry for a method should make clear what kind of parameters are expected and what the return value could be. However, documentation is rather freely formatted, so it would be difficult to implement in a generic way (without adding formatting restriction to classes).
JavaFX compiler for Linux very soon? May 11, 2009
Posted by claudio in Desktop, GNU/Linux, Java, Programming, Solaris.Tags: Java, javafx, netbeans, sun
1 comment so far
Good news. It seems that Linux and Solaris are getting the JavaFX development kit. Finally. In the fight against Silverlight and AIR every developer counts. Still some questions remain open:
- Will SUN open JavaFX completely now (don’t make the JDK error twice!)?
- When will -at least- Netbeans get a JavaFX graphical editor in the same level as the Netbeans’ Matisse Swing editor?
- And last but not least, what will Oracle do with JavaFX when it owns SUN?
Anyway, if the apparently well-informed rumour is true, it is indeed good news.
I don’t like monkeys in the house April 24, 2009
Posted by claudio in Desktop, General UNIX, Java, Programming, Ubuntu.Tags: GNU/Linux, Java, mono
2 comments
There have been some controversy about the .Net clone on Gnu/Linux: Mono.
I have been running Linux before Mono appeared and I remember the discussions. To be short: most reasons to introduce .Net on Linux are clearly bogus today. If you really want to use a high-level language with a VM, well … use Java (there are java-gtk2 bindings if you prefer a more native look than swing-gtk or swt-gtk). If you want to make it perfect, spend a fraction of the time and money of copying/rewriting a full stack (including a VM) and fix what need to be fixed on Java (specially now that’s GPL2). Besides, there are pretty decent IDEs that make you productive . If Java isn’t your cup of coffee tea (It should be as C# looks pretty similar to me), there are tons of other languages with gtk-bindings (I use gtk2-perl).
Anyway, being a user of a minority OS, there was one argument that stuck then: “we will enable thousands of windows programmers to run their programs unchanged on Linux”. I remember the apocalyptic warnings of “jumping on the .Net boat or drown and disappear”. Guess what, it didn’t happen. And it won’t happen. Windows developers prefer to write for the full and up-to-date .Net stack instead of an outdated Linux-clone. Nothing earth-shocking here. As long as the complete stack is not open (libraries), you will always play -incompatible- catchup.
What did we get instead? Beside a few proprietary applications (that can be counted on one hand), we’ve got some tools and applications that mainly run on Linux. Some of them are very nice, but nothing revolutionary that can not be written in an other language.
Do we need to live in fear of Microsofts lawyers for a few applications that can be written in a risk-free language or stack (e.g. Tomboy => Gnote)? To be honest, as long as the OS and my DE (Gnome) don’t depend on Mono, I don’t really care. If Microsoft sends its lawyers, there is always “apt-get purge libmono0 mono-common”. The problem I see is that Novell is pushing really hard to make Gnome dependant on Mono.
Removing Mono in that situation will mean holding the broken pieces of the Desktop in your hands.
Still no javafx for Linux? March 3, 2009
Posted by claudio in Desktop, Java, Programming.Tags: Java, javafx, Linux, rant
3 comments
I use a lot of Sun software: java, mysql, virtualbox, solaris, solaris cluster, etc.
Today, while having a look at webservices as an alternative to Swing clients, I decided to have a look at Sun’s attempt at the RIA market: Java FX.
Sadly, the javafx sdk has only be released for windows and macos. I guess Sun doesn’t get it that it needs as many developers as possible as its alternative is a few years late compared to the competitors. And a lot of linux users are developers/admins…
I know they are workarounds to get the sdk running on linux, but why bother?
Perl’s new wave February 16, 2009
Posted by claudio in Perl, Programming.Tags: "Modern Perl", community, Padre, Perl
5 comments
We all remember the “Perl is dead” hype from not so long ago. In short: Perl 6 wasn’t there yet and perl ironically wasn’t a copy of the language of the day (python, ruby, c#, …).
I was positively surprised by the response of the perl community. It wasn’t the typical “our programs run fast” (to ruby fanboys*) or “space as syntax wtf?” (to python fanboys). Instead it seemed that community took notice of the criticisms and made pretty clear that waiting for Perl 6 was not an option. Today, Perl 6 is doing fine (you can write code in Perl 6) and so is Perl 5.
So what did the community do? Well, Perl Best Practices -and corresponding module Perl::Critic- was a milestone telling people to stop writing perl 4 scripts and respect sane best practices to achieve clean and elegant code. Next to the many great modules already at CPAN (DBI::*, POE::*, DateTime, DBIx::Class (after PBP), WWW::*, etc), the community decided to address some clear shortcomings.
Moose (inspired by Perl 6) was an answer to one of the -in my opnion- greatest shortcoming of Perl 5: the basic OO framework. Perl-based Catalyst jumped on the Ruby-On-Rail wagon. chromatic, a core developer and important community member, started to think out loud what actually “modern perl” means and how we can improve perl by getting rid of obsolete features and bad practices.
An other missing piece, was a beginners-friendly and perl-centric IDE. Padre is aiming to fill this need. Gabor Szabo was able to quickly form a community developing padre (including Alias of Strawberry Perl and PPI fame). I guess this was the kind of project I was waiting for.
I hope that by being part of this project I can contribute to this positive perl new wave.
* fanboy != user
Split one flac (+ cue) file into separate tracks (update: including embedded cue files) February 9, 2009
Posted by claudio in Desktop, Shell.Tags: flac, GNU/Linux, music
3 comments

You may have backupped your music cd’s using a single flac file instead of a file for each track. In case you need to split the cd-flac, do this:
Split the album flac file into separate tracks:
$ cuebreakpoints sample.cue | shnsplit -o flac sample.flac
Copy the flac tags (if present):
$ cuetag sample.cue split-track*.flac
The full howto can be found here (aidanjm).
Update (April 18th, 2009):
In case the cue file is not a separate file, but included in the flac file itself do this as the first step:
$ metaflac --show-tag=CUESHEET sample.flac | grep -v ^CUESHEET > sample.cue
(NB: The regular syntax is “metaflac –export-cuesheet-to=sample.cue sample.flac“, however often the cue file in embedded in a tag instead of the cuesheet block).
High-Order Perl now legally available online December 10, 2008
Posted by claudio in Perl, Programming.Tags: "High Order Perl", ebook, Perl, Programming
add a comment
In case you haven’t read it elsewhere, High-Order Perl written by Mark Jason Dominus is now legally available on-line without cost. Get it here.
Of course, if you find the book useful and/or interesting you should buy it. You will not only acknowledge Mark’s work, but you will keep the Perl book micro-cosmos alive. Books that help you learn and widen your knowledge are a must for a language to flourish (not only for languages, by the way).
Having the real thing before buying gives you the power as a programmer to decide if it’s worth your money (no one can buy 1000 books). This beats reading reviews, table of contents or even a quick look in the bookstore.
Thanks for the trust, Mark.
An old answer to a common Perl question: name of a variable as a variable? November 8, 2008
Posted by claudio in Perl, Programming.Tags: Perl
1 comment so far
While randomly “googling” I found an interesting news post from 1998:
People show up in comp.lang.perl.misc all the time asking how to use the contents of a variable as the name of another variable. For example, they have $foo = ’snonk’, and then they want to operate on the value of $snonk.
That’s very easy to do in Perl, so they usually get some people to tell them to do it. And they usually get some people asking them why they didn’t use a hash instead.
As a Perl programmer it’s probably one of the most common questions you will hear from people learning Perl. I remember posing the same question back then (before I got to the chapters of references and hashes
). Anyway, it’s a nice read and it may be an useful link for the next time (soon) someone asks you this question…









