Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: myQuestion.pl

by arturo (Vicar)
on Apr 17, 2001 at 20:06 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-24 16:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found