Re: accessor problem in OO

2006-05-29 Thread Chad Perrin
On Mon, May 29, 2006 at 06:39:57PM -0700, chen li wrote: > > > --- Chad Perrin <[EMAIL PROTECTED]> wrote: > > > On Mon, May 29, 2006 at 01:17:52PM -0700, chen li > > wrote: > > > Sorry but what I mean is "Beginning Perl" from > > > http://learn.perl.org/library/beginning_perl/ > > > > > > And

Re: accessor problem in OO

2006-05-29 Thread chen li
--- Chad Perrin <[EMAIL PROTECTED]> wrote: > On Mon, May 29, 2006 at 01:17:52PM -0700, chen li > wrote: > > Sorry but what I mean is "Beginning Perl" from > > http://learn.perl.org/library/beginning_perl/ > > > > And BTW I have a hard copy of "Learning Perl" by > > myself. > > I had a sneak

Re: accessor problem in OO

2006-05-29 Thread Chad Perrin
On Mon, May 29, 2006 at 01:17:52PM -0700, chen li wrote: > Sorry but what I mean is "Beginning Perl" from > http://learn.perl.org/library/beginning_perl/ > > And BTW I have a hard copy of "Learning Perl" by > myself. I had a sneaking suspicion you weren't talking about the Llama book, especial

Re: accessor problem in OO

2006-05-29 Thread chen li
Sorry but what I mean is "Beginning Perl" from http://learn.perl.org/library/beginning_perl/ And BTW I have a hard copy of "Learning Perl" by myself. Li --- "Randal L. Schwartz" wrote: > > "chen" == chen li <[EMAIL PROTECTED]> writes: > > chen> I recently read chapter 11 about OOP fr

Re: accessor problem in OO

2006-05-29 Thread Randal L. Schwartz
> "chen" == chen li <[EMAIL PROTECTED]> writes: chen> I recently read chapter 11 about OOP from the online chen> book "learning perl". Here are some example codes chen> from chapeter 11: There is no "online book" named "Learning Perl". If you see it online, please report the copyright vio

Re: accessor problem in OO

2006-05-29 Thread chen li
Hi Peter, Thank you very much, Li --- Peter Cornelius <[EMAIL PROTECTED]> wrote: > > On May 27, 2006, at 3:56 PM, chen li wrote: > > > > Based on what I learn the regular method to defer > a > > hash reference to get specific value takes this > > format: > > > > $ref_hash->{key1} > > > > bu

Re: accessor problem in OO

2006-05-28 Thread D. Bolliger
Peter Cornelius am Montag, 29. Mai 2006 05.30: > On May 27, 2006, at 3:56 PM, chen li wrote: > > Based on what I learn the regular method to defer a > > hash reference to get specific value takes this > > format: > > > > $ref_hash->{key1} > > > > but in this line > > $_[0]->{_name}= $_[1] if define

Re: accessor problem in OO

2006-05-28 Thread Peter Cornelius
On May 27, 2006, at 3:56 PM, chen li wrote: Based on what I learn the regular method to defer a hash reference to get specific value takes this format: $ref_hash->{key1} but in this line $_[0]->{_name}= $_[1] if defined $_[1] the format is array element->{_name} Yes, the contents of the a

Re: accessor problem in OO

2006-05-27 Thread D. Bolliger
chen li am Sonntag, 28. Mai 2006 00.56: [...] > Thank you all for the reply. > > > Based on what I learn the regular method to defer a > hash reference to get specific value takes this > format: > > $ref_hash->{key1} yes, if $ref_hash is a hash reference, you get the value associated to the key '

Re: accessor problem in OO

2006-05-27 Thread chen li
--- Peter Cornelius <[EMAIL PROTECTED]> wrote: > This might be a little more clear if you break down > the way arguments > are being passed in and what they actually are. It > sounds like > you're aware that the arguments are passed in as a > list name @_, it > looks like the arguments ar

Re: accessor problem in OO

2006-05-27 Thread D. Bolliger
Anthony Ettinger am Samstag, 27. Mai 2006 22.02: > sub foo > { >my $self = shift; #object > >if (@_ == 0) #any other arguments? >{ > return $self->{'foo'}; #getter (no other arguments) >} > > return $self->{'foo'} = shift; # setter (save next argument) > > } Hi togethe

Re: accessor problem in OO

2006-05-27 Thread Anthony Ettinger
sub foo { my $self = shift; #object if (@_ == 0) #any other arguments? { return $self->{'foo'}; #getter (no other arguments) } return $self->{'foo'} = shift; # setter (save next argument) } On 5/27/06, Peter Cornelius <[EMAIL PROTECTED]> wrote: This might be a little more c

Re: accessor problem in OO

2006-05-27 Thread Peter Cornelius
This might be a little more clear if you break down the way arguments are being passed in and what they actually are. It sounds like you're aware that the arguments are passed in as a list name @_, it looks like the arguments are something like this: @_ = ( #< A list { _name =>