Movatterモバイル変換


[0]ホーム

URL:


perlstyle
(source,CPAN)
You are viewing the version of this documentation from Perl 5.36.3.View the latest version

CONTENTS

#NAME

perlstyle - Perl style guide

#DESCRIPTION

Each programmer will, of course, have his or her own preferences in regards to formatting, but there are some general guidelines that will make your programs easier to read, understand, and maintain.

The most important thing is to usestrict andwarnings in all your code or know the reason why not to. You may turn them off explicitly for particular portions of code viano warnings orno strict, and this can be limited to the specific warnings or strict features you wish to disable. The-w flag and$^W variable should not be used for this purpose since they can affect code you use but did not write, such as modules from core or CPAN.

A concise way to arrange for this is to use theuse VERSION syntax, requesting a version 5.36 or above, which will enable both thestrict andwarnings pragmata (as well as several other usefulnamed features).

use v5.36;

Regarding aesthetics of code lay out, about the only thing Larry cares strongly about is that the closing curly bracket of a multi-line BLOCK should line up with the keyword that started the construct. Beyond that, he has other preferences that aren't so strong:

Larry has his reasons for each of these things, but he doesn't claim that everyone else's mind works the same as his does.

Here are some other more substantive style issues to think about:

Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.

The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.


[8]ページ先頭

©2009-2025 Movatter.jp