Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Math::Vector - request for comments

by chromatic (Archbishop)
on Dec 18, 2001 at 01:58 UTC ( #132686=note: print w/replies, xml ) Need Help??


in reply to Math::Vector - request for comments

Your last six methods could be consolidated:
no strict 'refs'; foreach my $axis ('i', 'j', 'k') { *{ $axis } = sub { my $self = shift; if (@_) { $self->{"_$axis"} = shift; } return $self->{"_$axis"}; } }
If you're willing to limit this to Perl 5.6 and newer, you could also look into lvaluable subroutines. Class::Accessor also handles much of the same thing for you nearly automagically.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://132686]
help
Chatterbox?
[trippledubs]: stevie are you still ignoring me
[trippledubs]: either way; sorry.
[trippledubs]: Someone please tell Steveie that I humbly and sincerely apologize
[trippledubs]: i'll try again later. wink

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2017-03-27 03:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (315 votes). Check out past polls.