Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re^5: Tutorial: Introduction to Object-Oriented Programming

by rdfield (Priest)
on Dec 18, 2002 at 11:41 UTC ( #220819=note: print w/ replies, xml ) Need Help??


in reply to Re^5: Tutorial: Introduction to Object-Oriented Programming
in thread Tutorial: Introduction to Object-Oriented Programming

Maybe I'm missing something with your implementation but wouldn't something like:

package Rover; #a class of it's own ;) sub get_set_color { my $self = shift; if( @_ ){ $self->oo_set( 'color' , $_[0] ); } else { $self->oo_get( 'colour' ); } }
lead to the same problem that Abigail-II was talking about in the first place?

rdfield


Comment on Re: Re^5: Tutorial: Introduction to Object-Oriented Programming
Download Code
Replies are listed 'Best First'.
Re: Re: Re^5: Tutorial: Introduction to Object-Oriented Programming
by fruiture (Curate) on Dec 18, 2002 at 13:45 UTC

    Well, as long as you base such a thing upon a hash (and a variable solution like the Superclass must use a hash), you cannot avoid that, but it's limited to a few lines of accessor method code. I don't think it's productive to assume a typo wherever possible and to make it impossible to break things.

    This cannot happen when you create an accessor method automatically.

    --
    http://fruiture.de

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2015-07-30 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls