How I got re-acquainted with Perl's Grand-Pa!

granpa.png

And suddenly I remembered that I promised myself, at YAPC::EU, that I would write a tmux plugin to implement a yakuake like pane handling.

With some time and energy on my hands I created a directory, initialize a repo and was on my way to write some perl. I took one hour to draw a few ideas and that's when GranPa Bash knocked at the door.

I know, you know, everyone knows that Perl build a lot on bash, at least its syntax, and in this very case it seemed to me that writing this in Bash would be better. It's mainly command calling, there is no complicated process to map, it should be quite easy in bash.
And I was in the mood!

Every second year I beat myself up because I always refuse to learn more sed or awk. It's not that I don't use them, it's just that every time I do, I get so frustrated that I end up writing some Perl.

As for Bash, Having had the displeasure of fixing a huge code database that I did not write, I simply think it's the devil's work and I have forbidden it in all the project I manage. If it's more than 5 lines of Bash, then it should be written in Perl; no discussion. A rule I am keeping (well, not in this case).

But this time I was on! I'd write some Bash, and maybe learn a thing or two about it in the process.

Note that it is a bit of a silly idea to learn more Bash that I know I will not let myself use when I have Go (finally people are writing command line apps again, the Java years were miserable years), and JS/NodeJS and so much fun P6 on my list. But I thought that after writing a P6 module, it would be fun to look at more "archaic" languages, there's a lot to learn from them, the design considerations they implement, and the people who wrote them. I have a great respect for what developers did years ago just an evening spend in coreutils docs makes me go "hmmm, haaaa, ohhh", Bash is also fascinating.

Anyone complaining about 'my' in Perl should be forced to write Bash with 'local' and see how much fun it is. It's actually as much fun as writing with everything global, because sometime it does not do what I expect it to do. I ended up removing local!

I learned a other things, I won't call functions some-name, with a dash, ever again in my life as ctags refused to parse them. Why would one ever want to do that? tmux functions are all some-name in format. Following like a sheep is comfortable but not always a good idea.
I also needed two characters to tag panes, that lead to a miserable period trying to find some unicode characters that would not mess konsole's display. It's also frustrating to find a unicode character that looks like one wants. Larry Wall made it look sooo easy with Chinese characters, I find it difficult to find a house symbol and even more difficult to find one that displays correctly. but I also found this little gem of a web page http://shapecatcher.com/index.html which let's you draw what you are looking for.

I learned two things. I love-hate Bash as much as I love-hate make (and all its derivated small mongrels). I also understand better how much of a liberation Perl must have been for people programming in Bash. It may look a bit the same but while Bash is a charming, banjo playing, crazy GranPa, Perl is a the uncle, with the huge tool shed, you want to be like when you grow up.

I also found out that I am happy to be part of a community that appreciate many languages, I may find Python boring to write code in but I can see how nice and useful it is, a great language actually; I grind my teeth at large Bash script but there's also beauty in it. All this I learned because the Perl developers I have been in contact use many languages, There is little to no dogmatism and we don't spend our time slandering at languages we are not intelligent enough to use, we fix stuff, we invent, we cooperate and if needed coerce other bits and pieces in our solutions. We are solution people.

We also have a great community, and I could see that clearly at YAPC::EU, and a great language and many other cool languages to play with. We live in a fascinating time.
Long live Perl and its GrandPa (and mongrels).

Leave a comment

About Nadim Khemir

user-pic I blog about Perl.