Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

A very simple OO example for total beginners

by Anonymous Monk
on Sep 02, 2003 at 00:24 UTC ( #288217=perlmeditation: print w/replies, xml ) Need Help??

In the spirit of offline tutorials...

This is a very minimalistic module and a script that uses it, its a gentle - and highly practical - introduction for the OO newbie, or OO scaredy as I once was...

- bl0rf

edited: Tue Sep 2 13:54:30 2003 by jeffa - formatting, made link followable

2005-10-14 jdporter moved from Tutorials. The subject was reposted as this non-offsite, non-anonymous Tutorial.

  • Comment on A very simple OO example for total beginners

Replies are listed 'Best First'.
Re: A very simple OO example for total beginners
by NetWallah (Canon) on Sep 02, 2003 at 05:25 UTC
    Nice, gentle intro - good job!

    A couple of easy-to-fix tips :

    • The link in your note above is not click-able. Here is a Clickable version of your
    • In your 'add' and 'subtract' methods, your return values though correct, are not explicit. I would rather see the code written as
      $self->{num} += $add; return $self->{num};
      Yes, that could be single-ligned like
      return $self->{num} += $add;
      But that could potentially cause brain-damage for confused newbies.
Re: A very simple OO example for total beginners
by herveus (Parson) on Sep 02, 2003 at 11:18 UTC

    The web page needs some formatting cleanup badly.

    Lose the funky background. It intrudes on the text itself.

    Wrap your code in PRE tags so the line breaks come where you meant them to. It showed up on my screen all flowed together in an unreadable mess.

    Because of these issues (primarly the latter), I was unable to look at it with a critical eye to give you any useful feedback on the content.


Re: A very simple OO example for total beginners
by nimdokk (Vicar) on Sep 02, 2003 at 12:09 UTC
    Apart from the formatting problems that someone else mentioned, looked pretty good. I have only a rudimentary understanding of OO in Perl, but it looked like a pretty simple, straightforward demonstration. You might want to consider adding a section that shows what the output of the print statements should look like.

    "Ex libris un peut de tout"
Re: A very simple OO example for total beginners
by bl0rf (Pilgrim) on Sep 04, 2003 at 01:26 UTC
    I would like to thank all of you for taking a look into my OO example-tutorial. I greatly appreciate all of your suggestions.

    I have added the value-return for methods that operate upon the number. And I have added the printed output from

    In addition I finally became a monk :-) ( yes I do have that fresh-car smell now and I am confused ) and I have also posted the tutorial as a full-fledged node. I would be grateful if a moderator deleted the node that was only a link to the document.

    An aside:
    I consider the background very Art-Deco and it lends character to my site. Herveus, the formatting problems you mentioned are pretty horrible - I have never experienced them in my browser, would you be kind enough to tell me your browser type+version? Thank you for notifying me. ( as well, all of the content on the page was in pre ).

    update (broquaint): dropped <pre> tags and added formatting

Re: A very simple OO example for total beginners
by guha (Priest) on Sep 03, 2003 at 08:44 UTC

    Apart from the psychedelic background, have you seen any books printed on that type of paper, I think it is very good considering the intended audience.

    My advice is to write up a true node in this place, instead of just the link

    And by all means register yourself and get a handle so your efforts can be rewarded ;-)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2022-01-28 07:01 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (73 votes). Check out past polls.