in reply to Class confusion when testing using ref()

use parent 'Particle';
...
our @ISA = ( 'Particle', );

I don't understand the point of explicitly assigning to  @ISA in the child classes. Isn't parent designed to do this (among other things)? See also base.

Replies are listed 'Best First'.
Re^2: Class confusion when testing using ref()
by chromatic (Archbishop) on Jan 05, 2014 at 01:18 UTC

    Yes, but that's yet another one of the flaws of the documentation which tries to teach Perl's bare-bones OO through years of cruft. I'm trying not to rant about the silliness of "I want to learn how to do OO in Perl manually before I learn how to do it right with decent tools and documentation", but I'm not sure I can do it politely. Suffice it to say "This confusion is exactly what everyone should expect from trying to unify various tutorials written to various fads at various points in the past 20 years."

      ... before I learn how to do it right with decent tools and documentation"

      Is that a recommendation to move directly to (one of) Moo(u)se?

      If so, which one?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        I choose Moose for the first edition of the Modern Perl book and am still happy with that. At the time, it was the most complete of all of the object systems. When I was revising that chapter for the 2014 edition, I thought about the decision again and stuck with Moose. It's the de facto standard for syntax among all of the Moosey alternatives. It's the basis for p5-mop. It has the most users and documentation. The other strong competitor is Moo, and that automatically upgrades its objects to Moose objects when you exceed the facilities Moo provides.

        Another consideration—strictly from the writer's point of view—is that I didn't have to tell people to install something else to get the metaprogramming examples to run correctly.

        I decided that a novice wouldn't go wrong learning Moose, because that novice could decide to switch to something else when he or she knew enough to make an informed decision. Even though I'm enjoying Moops in my personal projects right now, I'm not the target audience.