Programming with Moose/Preface< Programming with Moose
The first goal of a book should be to convince the reader it's worth reading in the first five minutes. It shouldn't take you five minutes to read this.
Should I even be reading this?Edit
This book is free, and in being free I can willfully tell people how to save time up front: If the following applies to you do not waste your time and go away:
- You don't use the OOP paradigm and you don't care to know what you're missing.
- You won't entertain the idea of making your perl programs dependent on a module that does not exist in the CORE distribution.
- You think all syntax that looks foreign to perl is bad.
- You're the benchmark-before-completion type of programmer, or you won't compromise on execution speed.
- You don't like radical change.
Tell me what you're 'twerkin withEdit
Let me start out with the problem: perl5 is old and crusty.
The OOP paradigm of Perl5 is in severe need of a face lift. Not only does it lack functionality that other programming languages have, the functionality it does have it does poorly. Moose will scrape off this crust and abstract away these shortfalls. All hail the shiny newer Moose-powered perl.
Moose is an awkward gem, and telling you what it's about is more of a boring practice of pedantry - one we will tackle at a later point. Moose does a lot, and it has ambitious goals, but aside from what it wants to accomplish, you'll find it delivers on the following:
- It will eliminate the need for the variety of modules that help compensate for that aforementioned old and crustyness.
- It will make programming more fun and less tedious. To further assist the hype-catalyst, it will make the fun more fun, and the tedious more fun, and the tedious less existent and.. or something...
- It will provide a versatile framework for which you can quickly prototype, and meld real-world problems.
- It will give you real world practice with another up and coming paradigm: AOP.
Be prepared to leave behind all of your old perl-OOP practices. Moose doesn't play well with them: it single-handedly replaces them! No more need for
Class::Accessor, or writing manual checks using
ref() inside of your app. Gone are the days of using Conway's cursed
NEXT, or violating blackbox rules to get the job done. Tokens, Models, and Events are all that you should be thinking of. Moose will think of the rest for you in a totally impersonal pre-thought-out fashion of course.
One more thing, this book goes about teaching Moose by comparing the "(old) perl way", with the "(new) Moose way." If this analogy bothers you, you can find the non-entertaining Moose docs on CPAN.
There is in addition a set of syntax docs in this book, which are surely more neutral.
- ^ Moose is not a source filter. The syntax looks foreign to native perl because the idiom
bareword=>()is not adopted anywhere in the Perl example. Moose has no voodoo of the sourcefilter sort.