and this: the scalars $PPmy $pp=new ball("Ping-Pong");
is in order.package ball; # things from here will be of the ball class # Makes a new ball object. sub new { # assign all my parameters my ($class, $name, $size) = @_; my $self = {}; # This will be our new object # Mark this hash ref as a "ball" object bless $self, $class; # do our initialization (add useful defaults) $self->{'name'} = $name || "unnamed"; $self->{'size'} = $size || 0; return $self; }
I think that there's a lot that you're taking for granted about OO and Perl OO. As this is a draft that's fine, but you need to explain more. pjf and I do Perl training courses that cover both references and Perl OO. Feel free to read over our course notes and see if there's anything there that can help you. http://www.perltraining.com.au/notes/
I hope this helps.
jarich
In reply to Re: Perl High School Graduation
by jarich
in thread Perl High School Graduation
by hsweet
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |