5 minimums for any perl script?
me at pedrofigueiredo.org
Sun Jan 29 21:35:48 GMT 2012
On 29 Jan 2012, at 21:02, Leo Lapworth wrote:
> 1) use strict; use warnings;
> - obvious why
> 2) all files to be perl tidied (ideally automatically)
> - it makes reading code easier, as long as there is a standard
> 3) All variable names to be clear about what they contain, no short
> variable names unless in a small loop (e.g. $i)
> - "But I know $e means...." doesn't help me in reading code
> 4) use Path::Class and always keep files/dirs as Path::Class objects
> as long as possible
> - this is a strange one, but it's more about being consistent and having
> $file->slurp; $file->openw() $dir->mkpath(). It seems to make code
> cleaner, others have
> suggested IO::Any, but that still has missing / odd behaviour for my
> liking at the moment
> 5) Always ask one other person to review your code
> What would yours be?
6) use App::Cmd (makes testing scripts a doozie, gives you getopt and help for free, and it's really easy to extend).
7) use Readonly.
8) *really* have a look in Task::Kensho.
More information about the london.pm