in reply to Passing package-level/helper variables to user coderefs
The cleanest way to go is indeed the hashkeys way. Several advantages: Clean namespace, extendible/ flexible, not dependent on the order of args. You say it uglifies the user code. Well, that may be true (qw/beaty eyes beholder/), but it is very readible:
This is a bit more writing than your examples maybe, but very clear.sub user_sub( my %input = @_; $input{numberX} * $input{multiplier} + $user_glob; }
And I think you summed up the pro's/contra's pretty well. Try to think more like: "is it clean/functional code?" than "is the code very nicely looking?". At least, that would be my approach.
Jeroen
"We are not alone"(FZ)
Fixed error
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing package-level/helper variables to user coderefs
by Anonymous Monk on May 18, 2001 at 19:20 UTC |