Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Perl OO newbie advice - object interaction

by japhy (Canon)
on Jun 21, 2006 at 11:28 UTC ( [id://556634]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl OO newbie advice - object interaction
in thread Perl OO newbie advice - object interaction

I think you're forgetting that the damage() method has to actually alter the object's hit-points:
sub damage { ... $self->{_hp} = $self->{_hp} - $hits; # or, more succinctly: # $self->{_hp} -= $hits; }

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-23 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found