good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Practical example of "Is Perl code maintainable"by cLive ;-) (Prior) |
on Aug 13, 2007 at 20:22 UTC ( [id://632303]=note: print w/replies, xml ) | Need Help?? |
I agree with tye - does look like golf :) There comes a time when you have to balance this stuff out in a shared environment. For example, I've been optimising stuff perhaps too far:)
What has come from this though is that I'm moving towards a more consistant @_ usage, and then passing the script through a source filter before publishing. IE, if the sub doesn't amend any arguments unexpectedly, I write code that shifts the args
but, before publishing, I run the code through a source filter to change it to: If the source filter may cause confusion by amending any of the arguments, I use @_ explicitly:
I personally like using subs that tweak args direct:
But I find that most people feel more comfortable with:
over
I'm sure there are some disadvantages to my approach, but as long as I keep it consistent, document the source filter and ensure I run tests before and after source filter is applied, I think I'm OK :)
In Section
Meditations
|
|