Re: Moose documentation, "methods" and all that jazz...

[email protected] (Marius Olsthoorn)
Newsgroups perl.moose
Message-ID <CAGPy9h7CLS4=M8ih+rw2b7o7ZQzV2G-fKosnLjOZf-5kpg2tMg@mail.gmail.com>
Hi,

You might want to look at the documentation of perl itself.

http://search.cpan.org/~jesse/perl-5.14.1/pod/perlobj.pod#A_Method_is_Simply_a_Subroutine

Good luck,
Marius

On Sun, Jul 3, 2011 at 11:52 AM, Meir Guttman <[email protected]> wrote:
> Hi all!
>
>
>
> First I should mention that I am a Perl newbie, using Perl for less than two
> years! I learned Perl by doing, never attending a formal course. And
> although I am using objects daily (how can one NOT using these?), I never
> created an OO package. This is my first post to this list.
>
>
>
> I recently came to realize that it might be beneficial to implement a
> certain package as an OO one. My first stop was, as suggested by the CPAN
> Moose page, Moose::Manual and all its hyper-links. Here my enthusiasm
> waned...
>
>
>
> These pages deal a lot with "Attributes". In fact, four of these chapters,
> under different names, explain many aspects of these. Nevertheless, no
> explanation is offered as to the accessibility to these attributes. What are
> the scoping rules?
>
>
>
> As opposed to "attributes", "methods" get next to nothing treatment! The
> only coverage of methods is in the "concepts" chapter and it is literally
> this:
>
>
>
> --------------------
>
> Method
>
>
>
> A method is very straightforward. Any subroutine you define in your class is
> a method.
>
>
>
> Methods correspond to verbs, and are what your objects can do. For example,
> a User can login.
>
>
>
> sub login { ... }
>
>
>
> --------------------
>
>
>
> That's it folks! You will not find a "Methods" chapter there!
>
>
>
> I couldn't find a non-trivial example as to how to write a useful method or
> how to INVOKE one in your script. Yes, I did look at the "Cookbook"
> (Moose::Cookbook::Basics::Recipexxx)! But again, much about attributes
> there, very little about methods.
>
>
>
> One example: You see a lot of "my $self = shift;" in the code examples of
> some methods, but not a single word about what is it, of what use is it and
> why do you need it. (It seems to be a common convention to use this variable
> name...)
>
>
>
> Another: You will fleetingly find terms such as "privately accessible..."
> (those entities with a name starting in an underscore?) and "publicly
> accessible..." (those that do not?). What do these mean? Why do you need and
> where do you use one or the other? Can you "privately access" a "publicly
> accessible" entity? Not a word!
>
>
>
> In short, a lot to be desired...
>
>
>
> Can somebody point me to a better source?
>
>
>
> Meir.
>
>
>
> Please, don't flame me! Even though I should know a lot more about many more
> things in Perl, basic and advanced, an introduction such as Moose::Manual
> should be peppered with hyper-links to even basic concepts such as packages,
> and so. Bear with me...
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.