CPANPLUS::Styleguide - Style guide for CPANPLUS contributions
|
CPANPLUS::Styleguide - Style guide for CPANPLUS contributions
This is a list of guidelines for code to be integrated in the
CPANPLUS namespace.
It is highly recommended that CPANPLUS submissions follow these
guidelines. Code which does not should deviate for a good reason.
For example, a Tk shell wouldn't be expected to follow the
no non-core modules rule, because using that shell is not
a requirement for using CPANPLUS. Apply common sense, and, if
in doubt, send a mail to the development list at
cpanplus-devel@lists.sourceforge.net.
- All code should run under warnings and strict, although strict refs
may be disabled for sections if required.
- Do not use global variables. Try to solve problems by storing values
in objects, or, preferably, use closures to access private data.
- The return values of function calls should be checked. This applies
to functions like
open
, printing to filehandles and so on.
- In general, avoid using eval or system calls. However, eval should
be used to wrap modules which can die.
- CPANPLUS should not die, croak or confess. With the exception of those
in Shell modules, functions should not print either, but use Error
to pass messages to the stack.
- Follow the established division of functions in the project.
Internals contains the grunt work. Backend provides a
coding interface. Shell contains look and feel code.
Errors and warnings are handled by Error. Configuration
will always be read by Configure.
- Do not hardcode locations, script names and so on. Always use
Configure for this.
- Code reuse is recommended. Reuse existing functions where possible.
If needed, refactor them, but ensure backwards compatibility!
- The API provided by Backend should be backwards compatible with
earlier releases.
- Try the perl solution first. Use command-line tools as a last resort.
- Do not rely on modules which are not part of the core as of 5.5.3
with the exception of those bundled with CPANPLUS. If you must
use modules which are not core, provide a less featured alternative
function as well. CPANPLUS basic operation should not require
the installation of any modules.
- All solutions must be designed to work on all supported platforms.
- All solutions must work for the target perl versions, which are 5.5.3
up to and including the latest bleadperl.
- Functions should, in most cases, return a hash reference. Look at
related functions to see what is appropriate.
- Functions should take a hash of arguments, even if they currently
only have one argument.
- Follow any additional guidelines set forth in the perlstyle manpage
and perlmodstyle
This pod text by Ann Barcomb <kudra@cpan.org>.
The CPAN++ interface (of which this module is a part of) is
copyright (c) 2001, 2002 Jos Boumans <kane@cpan.org>.
All rights reserved.
This library is free software;
you may redistribute and/or modify it under the same
terms as Perl itself.
the perlstyle manpage, perlmodstyle
CPANPLUS::Styleguide - Style guide for CPANPLUS contributions
|