The line starting with "my $seti" is using the idiom of Object Oriented programming. I recommend reading a tutorial on Object Oriented Perl here at the Monastery. The third one in the list was also recommended by Louis_Wu above.

Anyway to be brief, it is a very useful way to deal with data and subroutines (or "methods") as belonging to a metaphorical object.

In this case a new object is being created based on the WebStats object template by calling WebStats' object constructing subroutine (called "new"). The arrow means "the WebStats method called ..." and the ampersand which normally preceeds a subroutine you are calling is left out by convention. The constructor method is given an email address and returns a WebStats object, which gets put into $seti.

$seti is now an object which knows everything a WebStats object should know, like its email address (which you told it) and how many units it has processed. It has a method (a subroutine) called "numResults" which when called returns the number of units processed.

You will find that you can do an awful lot of things with the CPAN (www.cpan.org) and just this knowledge, but I *urge* you to read the above tutorial and some of the very good books or online sites recommended by the nice monks above. Perl.com does have a Documentation page, also perldoc.com has all the manuals that come with perl.

But amazingly enough, as Juerd told you there is a whole book online for free! Can you imagine it! Chapter 11 is all about Object-Oriented Perl. Run, don't walk to it. We can answer individual questions but you will be able to make the most out of Perlmonks (and the CGI.pm module, and ..) if you take advantage of these wonderful resources.


In reply to Re: Re: Using modules for Newbies by mattr
in thread The Gates of Perl are not newbie friendly. by Hielo

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.