Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to (continue) learn Moose for using it "fairly" well? [closed]

Tags:

perl

moose

Although I am not a Perl guru, I use Perl and I can write object-oriented programs the "good old" way.

Now I would like to learn Moose. I've already (so-as) chewed the basic documentation, and my first Moose and roles are already working, but I'm miles away from understanding how Moose actually works.

Question 1: Is it absolutely necessary to understand how Moose works to write "pretty good" programs?

Honestly, I don't quite understand the old object system. Something I vaguely remember reading is that it's actually a reference to a data structure, but I never explored deeper. It was sufficient for me to know how and when I needed to use bless, autoload etc. and things simply worked. Maybe some of my old modules can be written more effectively. But for me, they work and work well.

Is this similar to Moose? Or does someone writing "enough-good" programs with Moose need to understand how it works "inside"?

The question arises for the following reasons:

In the METACPAN are dozens of modules that help write Moose objects even more easier and simpler.

Examples at random:

  • https://metacpan.org/module/MooseX::StrictConstructor (ok, easy to understand)
  • https://metacpan.org/module/MooseX::HasDefaults (ok, easy)
  • https://metacpan.org/module/Method::Signatures::Simple (bump! haven't idea what are the signatures, and this Module is the "easy" one.)
  • https://metacpan.org/module/MooseX::AlwaysCoerce /hmm.... :(/
  • https://metacpan.org/module/MooseX::LazyRequire /hmm... :(/
  • https://metacpan.org/module/MooseX::AbstractMethod
  • https://metacpan.org/module/MooseX::AttributeShortcuts (Shorthand for common attribute options - so probably it is a helper - but, is it really useful to learn?)

and many-many more (don't want cite here another 10-20 modules)

And now the main question:

Are there any good books with the instructions, examples and recommendations (good practices) for:

  • what from the above listed modules are recommended to use routinely from the start?

The above modules were surely not developed only because the author just hasn't what to do. Certainly they are useful and helpful. But learning (read: trying to understand) tens of many different modules (especially those who play with Moose internals) is an extremely long process. On the other hand, if they are not used, my programs will be unnecessarily complicated, and I will be dealing with things already resolved.

Moose should be (and probably is) a revolutionary system. Only I'm starting getting lost.

Edit: I just found Reindeer. Probably this module is a partial answer to the question: what modules are useful to use from the start (or most of time)

PS: I'm not sure than this question is ok for SO. If not, please move it to somewhere or close it. I asked it here because the SO-perl community is a really helpful place, and I don't know how to continue to learn Moose.

like image 613
cajwine Avatar asked Sep 23 '12 11:09

cajwine


3 Answers

Ricardo Signes's "Moose is Perl: A Guide to the New Revolution" contains a lot of valuable information and advice. Grab the PDF here: http://rjbs.manxome.org/talks/moose/

like image 53
Sebastian Stumpf Avatar answered Oct 19 '22 03:10

Sebastian Stumpf


To answer your first question: Not knowing how things work inside is the whole point of abstraction. While knowing the insides sometimes gives you better idea why things work the way they do (and more so with something as complex as Moose), you can write code just fine without it. When you run into a problem, you may dive a bit deeper to understand what’s wrong.

The second question, how to learn Moose, is really not a good fit for Stack Overflow.

like image 4
zoul Avatar answered Oct 19 '22 05:10

zoul


Google "The Moose is Flying". You will find all you need there

like image 2
Borodin Avatar answered Oct 19 '22 03:10

Borodin