Yes, there's presentations and tutorials spread all over the Internet, but the official, always up-to-date, documentation is on the CPAN here. In that documentation are a set of tutorials called the Cookbook.

There isn't much to learn about basic Moose:

package Shape; use Moose; has color => ( # an attribute called 'color' is => 'rw', # creates an accessor for the color isa => 'Str', # and it's a string ); package Circle; use Moose; extends 'Shape'; # Circle isa Shape has radius => ( is => 'rw', isa => 'Num' ); sub area { my $self = shift; return 3.141 * $self->radius ** 2 } package Rectangle; use Moose; extends 'Shape'; # Rectangle isa Shape has width => ( is => 'rw', isa => 'Num' ); has height => ( is => 'rw', isa => 'Num' ); sub area { my $self = shift; return $self->width * $self->height; } package main; use strict; use warnings; my $r = Rectangle->new(height => 2, width => 2.5, color => 'green'); my $c = Circle->new(radius => .5, color => 'yellow'); printf "My %s is %s and has an area of %0.2f\n", ref $_, $_->color, $_ +->area for $r, $c; $c->radius(1); # The circle is now twice the size printf "My new Circle is %s and has an area of %0.2f\n", $c->color, $c +->area

Moose just makes it so quick and easy. Of course, Moose can do so much more, but that's what the documentation is for.

(Yes. I know. Roles would have been better)


Unless I state otherwise, all my code runs with strict and warnings

In reply to Re^3: looking towards learning OOP by FunkyMonk
in thread looking towards learning OOP by spx2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.