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

Re: myQuestion.pl

by arturo (Vicar)
on Apr 17, 2001 at 20:06 UTC ( #73215=note: print w/ replies, xml ) Need Help??


in reply to myQuestion.pl

Hm ... thinking back, I'm not clear how one might write this one in an OO fashion ...

package Action; sub new { my $class = shift; my $self = {}; bless $class, $self; $self; } # other methods sub set_nobility { if ($self->{type} eq 'suffer') { $self->{nobility} = $self->{acted_upon) eq 'slings and arrows of out +rageous fortune' ? 1 : .5; } if ($self->{type} eq 'take arms against') { $self->{nobility} = $self->{acted_upon) eq 'a sea of troubles' ? .9 +8 : .2; } } sub nobility { return $self->{nobility}; }

Putting it to use is left as an exercise for the reader ... erm, author.

Philosophy can be made out of anything. Or less -- Jerry A. Fodor


Comment on Re: myQuestion.pl
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (17)
As of 2014-09-22 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls