Book mini-review: Modern Perl May 3, 2011Posted by claudio in Uncategorized.
Tags: book review, Chromatic, Modern Perl, Perl
Ok. You are really lazy, curious and want to know my opinion? Buy the book. It’s great. If you are less lazy, keep reading.
I was really exited about this book. Even before the book was published, chromatic regularly posted very interesting articles and, maybe more importantly, posed questions. It felt like chromatic was thinking out loud and he welcomed everyone who wanted to take part. The text for the book is open for collaboration and lively discussions took place in his blog. He goes a step further and offers the ebook and pdf version for free. It’s a good feeling to be sure that you are not buying a cat in a bag.
What kind of book is it? It’s the kind of book that it’s fun to read (sadly this is not that common in the IT world). It’s not the kind of book that offends your intellect by trying too hard to be funny nor the dry stuff that put you into sleep. It’s not a reference. It’s not a tutorial. It’s not the book a would suggest for someone who wants to learn Perl, but it certainly be the one to read after that (if your friend is serious about programming he will not stop at “Learning Perl“).
Because the pdf is freely available you can have a look yourself at the contents, but just glossing over the titles of the chapters gives you a good idea:
- The Perl Philosophy
- Perl and Its Community
- The Perl Language
- Regular Expressions and Matching
- Style and Efficacy
- Managing Real Programs
- Perl Beyond Syntax
- What to Avoid
- What’s Missing
Modern Perl is not the book that teaches you specific technologies du jour. chromatic aims higher and moves the bar from “how” to “why”. By doing so it’s clear that for the author the Modern Perl revival is more than the sum of new CPAN modules fixing what’s broken in Perl 5. It’s a book about understanding the basics of Perl 5. The good and the bad stuff. And how to use this knowledge, a quest for Good Programming. I specially appreciate “The Perl Philosophy” as it manages to explain clearly the basic assumptions of Perl (and at the same time give a valid answer to the “write-only” accusations). Even if you have programmed Perl for a while, you’ll be surprised on how nice it is to see things clearly explained what you probably “kind-of” knew. chromatic’s inviting style helps a lot.
I pre-ordered the book on Amazon before it came out and I haven’t regretted it for a second. It lives next to my “Perl Best Practices” copy. I appreciate when content providers treat me with respect and not as a pirate (DRM!). That’s why I hope this publishing model is viable (open content, free pdf, free epub, companion site). I don’t mind voting with my wallet.
Springcleaning: App::Unix::RPasswd March 25, 2011Posted by claudio in Uncategorized.
Tags: App::Unix::RPasswd, cpan, Perl, UNIX
add a comment
It’s spring again, so I decided to prepare programs and libraries that are generic enough for CPAN.
App::Unix::RPasswd is the first candidate. App::Unix::RPasswd (remote passwd) is an application for changing passwords on UNIX and UNIX-like servers on a simple, fast (in parallel) and secure (SSH-keys) way. A salt-based retrievable “random” password generator, tied to the supplied server names and date, is included. The generated passwords, unique for each server, can be generated and automatically applied remotely. Because the salt is secret and the correct date string is required, the password for a specific server can only be regenerated by authorized personnel.
Perl 5.10 or higher is required. All recent GNU/Linux distribution have a recent perl (>= 5.10). In case you need it on Solaris 10, you can follow this howto to build a recent Perl (the best option in my view) or get precompiled packages from SunFreeware, Blastwave or OpenCSW.
Get it from CPAN:
Make noise like a camel! March 8, 2011Posted by claudio in Uncategorized.
Tags: Modern Perl, Perl, Perl core
1 comment so far
In December 2007 Perl hackers worldwide received a fantastic present. Five years and half after the previous major release (5.8) we got new language features and improvements to the perl interpreter itself. More importantly, it was the starting point for shorter and regular release cycles. Thank you, p5p!
Fast forward to today. The Perl community revitalised significantly and Modern Perl has a strong momentum. Books that reflect the community best practices were published and organisations created around the efforts of the Perl community to remove the baggage and create what was lacking. Already in 2005 “modern” applications and distributions started appearing in CPAN to complement core Perl: PPI (2005), Perl::Critic (2005), Catalyst (2005), DBIx::Class (2005), Moose (2006), Strawberry Perl (2006), local::lib (2007), Padre (2008), Dancer (2009), Try::Tiny (2009), perlbrew (2010), cpanminus (2010), etc. (And my excuses for the many modern projects I forgot to include.)
There is now some noise in the perl blogsphere that suggest that a very small window is open to introduce new things to Perl core, or rather move things from CPAN to core. Maybe the window is too small to get what we need (IMHO, a complete OO framework). Or it may be already closed due to the complexity and the quantity of extra work for the already heavy charged core developers.
Nevertheless, it’s a good thing (TM) that people defining the direction of Perl 5 know what Perl developers think. People that care and work with the language. Developers that –in stark contrast with fanboys– know what the strengths and the weakness are of their preferred language.
Perl core, documentation and Moose (aka “can of worms”) March 5, 2011Posted by claudio in Uncategorized.
Tags: Modern Perl, Moose, p5p, Perl
It seems I am not alone on the subject I raised in my New Years wishes (wishes, not demands). Good.
I wished –and still do today– that Perl releases would include Moose. I also wished for a tutorial/chapter on Object Oriented programming based on Moose for Perl newcomers. For this second wish I was specifically thinking on the upcoming release of O’Reilly’s “Learning Perl“. The nice authors answered (see comments) and stated that they foresee the inclusion of a Moose chapter, but in the more advanced title “Intermediate Perl” instead.
On perl5-porters, the mailing list where Perl 5 development occurs, there is now a related discussion triggered by David Rolsky’s work on a new Object Oriented tutorial to be included in the Perl core documentation. It is certainly a welcome update to the present tutorial, but its use of Moose as a best practice seems to be rather polemic.
Tom Christiansen made a valid argument against a new core tutorial that included Moose:
Please don’t include anything in the standard distribution that tells people they can’t use the standard distribution.
If you want to include something in the standard distribution whose entire focus is outside the standard distribution, then you should bring the thing that is outside, inside.
Of course, this is an argument to keep references to non-core CPAN libraries out of the core documentation (isn’t CPAN not our biggest selling point?). It does not take a lot of imagination to turn the argument around and use it for the promotion of a modern Object Oriented framework to core. I am aware of the serious problem caused by the dependency chain of Moose, but it’s not that bad.
By talking with a lot of people at the Perl booth at FOSDEM I was positively surprised by the level of interest in (modern) Perl. Newbies seemed really curious and old perlers that long ago moved to other languages (“Were is Perl 6?”) were enthusiastic to give Perl a second chance. The Moose examples in chromatic’s“Modern Perl” book were a very convincing illustration of what Modern Perl was.
When (re-)introducing people to 2011′s Perl I don’t want to explain boilerplate that is difficult to grasp for new programmers (or myself ). Besides, people who are new to Perl are not necessarily new to programming and they are right not to be willing to put up with the overhead of plain OO Perl. The people I have encountered in this situation (or introduced myself to Perl) welcome –without exception– Moose as innovative and stylish (yes: the holy grail of readable code). In 2011 no one, except ironically the people writing Moose itself and “legacy programmers”, should be forced to write OO boilerplate code.
The people are there, the code is there, the momentum is there. Do we dare to take the chance?
(Picture by Dunechaser)
Perl@FOSDEM and some photographic impressions February 8, 2011Posted by claudio in Uncategorized.
Tags: belgium, fosdem, fosdem 2011, foss, Free Software, Modern Perl, Padre, Perl, perl::staff
All right. FOSDEM was –as always– great. 4 to 5000 Free and Open Source people on the same event has to rock. While I attended many talks about different technologies (Devops aka “System Engineering meets development”, Monitoring, Go Programming language, …), I focussed mainly on the Perl activities (pun intended).
Following Gabor’s initiative (this guy runs on Duracell batteries), last year (2010) we set up the first FOSDEM Perl booth: one table, some volunteers, many visitors and great reactions. This year (2011) everything was even better. We had a big booth at the main hall, attributes (a giant Camel (!) and probably the biggest Perl book collection in the world (!)), books to sell, a packed developer’s room on Sunday, a Perl dinner and many volunteers. There were at any time several people at the booth and sometimes even too many . With so many volunteers it was possible to attend whatever session you wanted and also participate on the Perl developers’ room.
Here follow some pictures I took with some comments:
David Leadbeater’s Tracing Perl with DTrace/SystemTap
Liz and Wendy were to
crazy nice enough to bring their giant camel and the biggest Perl book collection in the world. Both attributed really attracted visitors.
We had several books to sell… but not enough. We were sold out of chromatic’s Modern Perl halfway the first day (20 books!) and dams’s Perl Moderne (not the same book) was almost sold out as well!
Wendy and dams (from Dancer and “Perl Moderne” fame).
Although we didn’t have Automating System Administration with Perl at the booth, several people passed and showed us proudly their copy bought at the O’Reilly stand.
Those guys had something to celebrate: a new Debian stable was born.
Our perl-friendly neighbours…
No pun intended (the text reads “Whinging Bastard”,
DevOps? – More than Marketing by James Turnbull) .
Spike Morelli’s I’m Going M.A.D..
We had 13 people attending the Perl dinner! From left to right: Zeno, Bart, Gabor, Liz, Wendy, Dirk and Balint (the rest arrived later).
Mark Overmeers’s Perl data structures.
David Leadbeater’s Tracing Perl with DTrace/SystemTap: very interesting for a Solaris guy like me.
Introduction to writing readable and maintainable Perl by Alex Balhatchet.
Paulo Castro (Packaging Perl and it’s deps…) took us to the Dark Side…
The image integration facilities of WordPress.com are pretty poor. If it wasn’t for some command line Perl foo, I would have given up posting this message. There is no way I would have gone through if I had to click 10 times for each picture…
What I would love to see in 2011 for Perl January 1, 2011Posted by claudio in Uncategorized.
Tags: 2010, 2011, Learning Perl, Moose, Perl
Anyway, too much to mention in detail, but I’ll remember the first Rakudo Perl 6 implementation for end users (how much vaporware do have working implementations), the release of Perl 5.12 with real improvements and with a new regular release cycle, the 1.0 release of the Moose Object System and the widespread adoption in the Perl world, the fast pace of the development of the Padre IDE, the enthusiasm of Perl::Staff at FOSDEM and CEBITT, the 10.000.000th (!!!!!) test report on CPAN thanks to the CPAN Testers, perlbrew, cpanminus, the release of the book Effective Perl Programming (2nd ed.) and Modern Perl…
Would asking more qualify as hubris? I have just a small suggestion and no idea of it would be realistic from a technical or commercial point of view:
- The Perl OO system is a present from Python. It’s flexible, it works and it needs a lot of boilerplate.
Without being a copy of Perl 6, though inspired by it, Moose is a well-thought, modern and rich Object system. I am realistic enough to understand that it won’t be part of Perl core, but it would be great candidate for a double life module (included in the Perl tar and available newer versions on CPAN). When needed or wished, one can always bless variables or use other CPAN modules for creating objects, but there would be a clear default way of doing it. Batteries included, one may say .
- Now getting a little personal, a little request to Randal L. Schwartz, Tom Phoenix, brian d foy: Please add a simple OO chapter based on Moose to -hopefully upcoming- Learning Perl, 6th edition (this is the commercial part mentioned before).
New Perl Hackers need to know what the preferred OO framework is on Modern Perl without resorting to Google. What better entry than that great book that helped a lot of us (including me) take our first steps in the world of Perl?
You never know… now is the time for wishes.
Update: Moose core-developer Stevan Little blogs about this post and brian’s comments beneath. I don’t know if chromatic’s post about “The Minimalist Object System and Your Lousy Axioms” is directly related to this or Stevan’s aforementioned clarification on the Moose ecosystem, but it’s certainly an interesting addition to the discussion.
Sometimes devices are funny (Logitech Squeezebox Touch) December 11, 2010Posted by claudio in Uncategorized.
Tags: device, flac, GNU/Linux, logitech squeezebox touch, music, Perl
Some time ago I bought a Logitech Squeezebox Touch for the living room. Attach a usb2 disk to it and say goodbye to your cds: it plays ogg, mp3, flac, etc.
While being a device geared toward the general public, the Logitech engineers didn’t forget that some people may want to have a look under the nice touch-screen interface:
$ ssh 10.0.0.100 -l root
This network device is for authorized use only. Unauthorized or improper use of this system may result in you hearing very bad music. If you do not consent to these terms, LOG OFF IMMEDIATELY.
Ha, only joking. Now you have logged in feel free to change your root password using the 'passwd' command. You can safely modify any of the files on this system. A factory reset (press and hold add on power on) will remove all your modifications and revert to the installed firmware.
With a little of humour in /etc/motd they welcome your changes and avoid at the same time a call to their support line .
In case you are curious:
# uname -a
Linux SqueezeboxTouch 18.104.22.168-rt16-332-g5849bfa #1 PREEMPT RT Mon Nov 8 12:48:28 MST 2010 armv6l GNU/Linux
# perl -v
This is perl, v5.10.0 built for arm-linux-gnueabi
Copyright 1987-2007, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
# ps awx |grep perl
28641 ? SN 0:42 /usr/bin/perl /usr/squeezecenter/slimserver.pl --charset utf8 --noweb --notranscoding --nosb1slimp3sync --nostatistics --noinfolog --nodebuglog --logfile syslog
28643 ? SN 0:01 /usr/bin/perl /usr/squeezecenter/gdresized.pl
29210 pts/0 S+ 0:00 grep perl
Perl and GNU/Linux for my flac files. You won’t hear me complaining…
Build Padre svn easily with perlbrew and cpanm December 10, 2010Posted by claudio in Uncategorized.
Tags: cpanm, Free Software, GNU/Linux, Padre, Perl, perlbrew, UNIX
Update: March 12, 2011
Because of the fast pace of the development of Padre, the/a Perl IDE, it’s may be nice to run a bleeding edge version. Or even better, as Padre itself is written in Perl, you may like to have a look at the sources and maybe contribute some code or help with the translations.
Follow this howto to build the latest Padre from source with perlbrew and cpanm. This way, you’ll get started in no time and you won’t even touch your system Perl installation (cleanup is just a “rm -rf” away…).
2. Install subversion (to check out the code), the compilations utils (gcc, g++, make) and the gtk2 header files. On Debian/Ubuntu:
$ sudo apt-get install subversion build-essential libgtk2.0-dev
An interesting -but not required- shortcut is to install the Padre release in your distribution to get binary dependencies:
$ sudo apt-get install padre
3. Checkout Padre from svn (I chose to install the sources under ~/Code/Padre, adapt accordingly to your standards):
$ mkdir -p ~/Code/Padre && cd ~/Code/Padre
$ svn co http://svn.perlide.org/padre/trunk
4. Install the modules that Padre needs before building the IDE.
$ cpanm Parse::Yapp Module::Install Locale::Msgfmt Alien::wxWidgets Wx
[... lots of output ...]
5. Build Padre.
$ cd ~/Code/Padre/trunk/Padre
Install the dependencies (thx to Perigrin for the simplified method):
$ cpanm --installdeps .
[... lots of output ...]
$ perl Makefile.PL
[... some output ...]
As said, development is happening fast on Padre and new releases of (external) CPAN modules are required often (some even updated by the authors in order to provide the functionality Padre needs). If a new version of a module is needed that is not yet on your cpan mirror, run cpanm (–mirror) again with a more up-to-date mirror. Run “perl Makefile.PL” again afterwards.
[... lots of output ...]
$ make test
[... lots of output ...]
6. Install padre (in the active perlbrew dependant directory) or just run the development version without installing it (including all changes to the code even after installation):
$ make install
[... lots of output ...]
$ ./dev.pl -a
EDIT: ZenoG’s article is a good followup post giving an step-by-step description of bug fixing is Padre.
App::cpanminus: zero-conf CPAN client December 10, 2010Posted by claudio in Uncategorized.
Tags: cpan, cpanm, Free Software, GNU/Linux, Perl, perlbrew, UNIX
cpanminus is a script to get, unpack, build and install modules from CPAN.
Why? It’s dependency free, requires zero configuration, and stands alone. When running, it requires only 10MB of RAM.
How does it work? Let try a big module with a lot of dependencies and C++ compiling activity. Install the application through cpan if configured (or with one of the standalone installations options):
$ cpan App::cpanminus
$ cpanm Moose
--> Working on Moose
Fetching http://search.cpan.org/CPAN/authors/id/D/DR/DROLSKY/Moose-1.21.tar.gz ... OK
Configuring Moose-1.21 ... OK
==> Found dependencies: Try::Tiny, Package::DeprecationManager, Test::Requires, Class::MOP, Sub::Exporter, Test::Fatal, Sub::Name, Data::OptList, Params::Util, List::MoreUtils, Task::Weaken
--> Working on Try::Tiny
Building and testing Moose-1.21 ... OK
Successfully installed Moose-1.21
$ perl -MMoose -e1
No errors. The modules (and their dependencies) installed just fine. Wow.