Re: help with classes...

2002-12-11 Thread Jenda Krynicky
From: "Todd W" <[EMAIL PROTECTED]> > Think about this: > > my($frank) = Person->new(); # class method -- $_[0] eq 'Person'; > > my($jimmy) = Person::new(); # plain 'ol function call -- $_[0] eq ''; Well $_[0] does eq '', but so does $_[78548654]. In this case $_[0] is undef and scalar(@_) == 0.

Re: help with classes...

2002-12-10 Thread Todd W
"Christopher J Bottaro" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hmm, i have more questions now. how does one make class methods vs object > methods? > > using the example from the tutorial... > sub name { > my $self = shift; > if (@

Re: help with classes...

2002-12-10 Thread Todd W
"Christopher J Bottaro" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hey, > i'm a c/c++ programmer struggling to pick up OO perl. i've been reading the > perltoot and i have question about the following: > > package Person; > use strict; > > sub new

Re: help with classes...

2002-12-10 Thread wiggins
I assume you have done your required reading: in the perldocs: perlbootPerl OO tutorial for beginners perltootPerl OO tutorial, part 1 perltootc Perl OO tutorial, part 2 perlobj Perl objects perlbot

Re: help with classes...

2002-12-10 Thread christopher j bottaro
hmm, i have more questions now. how does one make class methods vs object methods? using the example from the tutorial... package Person; use strict; sub new { my $self = {}; $self->{NAME} = undef; $self->{AGE}= undef; $self->{PEERS} = [];

Re: help with classes...

2002-12-10 Thread christopher j bottaro
thanks to both of yall for the explanations. so bless() is is where the magic happens? once something is given a type, then those subs become methods and a ref of the calling object is implicitly giving as the first arg? i see now, thats what i was missing before. everything is much more cle

Re: help with classes...

2002-12-10 Thread Sheriff Gaye
Forwarded Message From:"christopher j bottaro" <[EMAIL PROTECTED]>Reply-to:[EMAIL PROTECTED]:[EMAIL PROTECTED]:help with classes...Date:Tue, 10 Dec 2002 04:45:15 -0600MIME-Version:1.0Content-Type:text/plain; charset="us-ascii"Content-Transfer-Encoding:7bitMessage-Id:&

Re: help with classes...

2002-12-10 Thread Paul Johnson
christopher j bottaro said: > hey, > i'm a c/c++ programmer struggling to pick up OO perl. i've been reading > the perltoot and i have question about the following: Hopefully it won't be too much of a struggle. In contrast to C++, there is little magic going on behind the scenes. Read the sta

help with classes...

2002-12-10 Thread christopher j bottaro
hey, i'm a c/c++ programmer struggling to pick up OO perl. i've been reading the perltoot and i have question about the following: package Person; use strict; sub new { my $self = {}; $self->{NAME} = undef; $self->{AGE}= undef; $self->{PEERS} = []