The stupid question is the question not asked | |
PerlMonks |
Re^3: What would you change?by grinder (Bishop) |
on May 17, 2008 at 12:54 UTC ( [id://687084]=note: print w/replies, xml ) | Need Help?? |
When adding a new parameter to each call of a function, have the code behave one way with N args, and a different way with N+1. Ideally, by synthesising a default value for the missing parameter, and then going ahead and doing the same thing. There are many ways of working around this sort of codebase evolution. Having the code fail badly because one call was missed is just wrong. Perl is not C. As to the other point, yes it's true that prototypes catch things at the compilation phase, but it doesn't deal with passing a text string when a numeric was expected. For that, Params::Validate is a much more robust approach to ensure parameters are sane, especially in a large code base. • another intruder with the mooring in the heart of the Perl
In Section
Meditations
|
|