Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Using modules for Newbies

by mattr (Curate)
on Apr 20, 2003 at 15:04 UTC ( [id://251823]=note: print w/replies, xml ) Need Help??


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

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.

Replies are listed 'Best First'.
Re: Re: Re: Using modules for Newbies
by Hielo (Sexton) on Apr 20, 2003 at 16:29 UTC
    Ok, what I am seeing is making a bit mroe sense, sort of "through a glass, darkly" stuff.

    Let me play with it a bit, and go through that OOP tutorial, and I might know enough to know what I don't know.

    Man, I know this stuff is probably really basic to you guys, but it sure seems like greek to me (hey, and I know a little ancient greek!).

    Thanks for the help!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://251823]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-03-29 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found