|Think about Loose Coupling|
Modern Perl 4th Editionby likbez (Sexton)
|on Nov 17, 2017 at 18:42 UTC||Need Help??|
Order Modern Perl 4th Edition
Item Description: A good refernce book. Kudos for chromatic for making it availble freely
Review Synopsis: Suffers for overcomplexity
It's a usable reference (it's intended purpose) that covered all the most recent Perl enhancements and new features up to Perl 5.14 or even 5.22. Might also be beneficial to any seasoned Perl programmer who wish to update his knowledge of latest and greatest language features.
For those purposes most material that is covered is covered well, with the distinct approach that "newer is better". Kudos to you for making it available for free, as Simon Cozen's book now is somewhat outdated (2000). I actually like his approach better, although his examples look overcomplicated.
The problems start if you use this book to learn programming in Perl. It's bad book for this purpose. Clearly it is a "language junkie" written book. It does not distinguish between important and superficial/esoteric things in the language. Everything is, kind of, "treated equally" independent of complexity and the level of abstraction that a particular feature introduces: Ohh we have this great feature. Here it is ;-) This "Schwartzian" approach is a very bad idea for beginners, even if they know some other language really well. And not so good for accomplished programmers either, although they suffer less from it and can benefit from delving into most recent esoteric staff (sometimes :-). All-in-all the book suffers from "over-complexity for the sake of over-complexity" approach to Perl.
I also noticed two rather obvious problems with the book: (1) Looks like it does not cover Perl debugger. At all, as if it does not exists. (2) It does not contains adequate coverage of built-in functions such as index (mentioned only in passing in index), substr (not in the index), tr, to name a few.
Also regex searching on long strings with newlines is an important topic (modifiers s and m) for modern Perl usage, coverage of which can be improved and expanded.
As for advocacy of Moose, this was a very questionable decision on the part of the book author. Many organizations prohibit installation of SPAN modules for security reasons. In such cases you need to deal with modules included in the distribution, or jump through the hoops to get permission for "non-core" modules. Also quality of modules on CPAN varies greatly, many are unmaintained for years. Blank recommendation to use CPAN is a dangerous proposition.
Perl 5 now is the language that most people use in rather limited subsets, the idea which is missing from the book. Nobody probably knows or uses the "full Perl language". It is the classic situation with blind men and elephant. It is also true about other languages such as Python and Ruby.
Even using a very limited subset of Perl can be somewhat problematic as there are way too many special cases and gotchas. This is clearly non-orthogonal language and this has its strong and weak sides. How to avoid problem that arise from this is topic that is very important for Perl programmers. Aside from advocating to use scrit and warning the other relevant methods, such as switching to use of IDE are also missing from the book. for example, Padre or Pycharm can be used (Pycharm does support Perl, although this is not advertised). Any language is no just the language, but is the whole ecosystem which includes among other thing the debugger and IDE.
Please note that it does not make sense to adopt "Pythonista" approach to the same domain either, as it stands father from the spirit of "Classic Unix" than Perl to say nothing about related unhealthy infatuation with OO that Python promotes. OO actually is a pretty limited paradigm of programming suitable only in few (but important) areas; historically it came from languages oriented on simulation (Simula67), which is an important, but not all-encompassing domain; later it acquired some features of "compiler-complier" approach.
But other approaches also exist. For example, coroutines can also can be viewed as a software development paradigm for certain type of programs (that allows structuring the problem into multiple semi-independent passes with intermediate representation produced in each) and I am not sure that it is not better for this particular domain. Success on Unix pipes speaks volumes about power of this approach.
Aside from overcomplexity, another problem with the book is that it presents Perl as "one-dimensional" language. In reality Perl exists at least on three distinct levels:
1. Minimal Perl. Perl 4 subset of Perl 5 -- which surprisingly is adequate for many tasks; especially in Unix system administration area. This is the level of the language typically used in one-liners, small Unix-maintenance scripts, and such. This is s kind of "Perl as better bash, AWK and sed." level.
2. Basic Perl 5 -- Perl 5 with modules and references, but without fancy staff (like closures, OO, exceptions). This probably the mostly widely used subset.
3. Enhanced Perl 5 -- Perl feature level typical for people who speak at Perl conferences. That include polymorphism, inheritance and other complex staff that is useful for example for writing interactive program with complex GUI and such.
I think that any book that presents Perl only on level 3 (which is the case with this book) without mentioning of possibility of using Perl on level 1 and 2, suffers from overcomplexity. I think a proper book on Perl should be like an onion with at least three layers of coverage outlined above. Of course, such a book is very difficult to write.