From owner-man-jp-reviewer@jp.freebsd.org  Mon Nov  6 00:17:23 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id AAA19338;
	Mon, 6 Nov 2000 00:17:23 +0900 (JST)
	(envelope-from owner-man-jp-reviewer@jp.FreeBSD.org)
Received: from tortoise.jp.freebsd.org (root@tortoise.jp.FreeBSD.ORG [210.157.158.41])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id AAA19333
	for <man-jp-reviewer@jp.freebsd.org>; Mon, 6 Nov 2000 00:17:22 +0900 (JST)
	(envelope-from mistral@imasy.or.jp)
Received: from mistral.imasy.or.jp ([3ffe:505:2020:1:9862:d6f:50d0:dd32])
	by tortoise.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP/IPv6 id AAA23312
	for <man-jp-reviewer@jp.freebsd.org>; Mon, 6 Nov 2000 00:17:19 +0900 (JST)
	(envelope-from mistral@imasy.or.jp)
Received: (from yohta@localhost)
	by mistral.imasy.or.jp (8.11.1/3.7Wpl2-000920) id eA5FHH506387;
	Mon, 6 Nov 2000 00:17:17 +0900 (JST)
Date: Mon, 6 Nov 2000 00:17:17 +0900 (JST)
Message-Id: <200011051517.eA5FHH506387@mistral.imasy.or.jp>
From: mistral@imasy.or.jp (Yoshihiko SARUMARU)
To: man-jp-reviewer@jp.freebsd.org
In-Reply-To: Your message of "Sun, 5 Nov 2000 23:01:10 +0900 (JST)".
	<200011051401.eA5E1Af05479@mistral.imasy.or.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-2022-JP
X-Mailer: mnews [version 1.22PL4] 2000-05/28(Sun)
Reply-To: man-jp-reviewer@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: man-jp-reviewer 3058
Subject: [man-jp-reviewer 3058] Re: style.perl.7
Errors-To: owner-man-jp-reviewer@jp.freebsd.org
Sender: owner-man-jp-reviewer@jp.freebsd.org
X-Originator: mistral@imasy.or.jp

$B!!1n4]$G$9!#(B

2000-11-05($BF|(B) 23:01:10.$B:"!";d$O=q$-$^$7$?!#(B

>   style.perl.7 $B$N=iLu$G$9!#(B

$B!!$9$$$^$;$s!"(Bstyle.perl.7 $B$N86J8;}$C$F$$$k?M$O>/$J$$$G$9$M!#(B
  $B$=$s$J$KD9$/$J$$$N$G1Q(B/$BF|(B $B$N(B diff $B7A<0$G=P$7D>$7$^$9!#(B


--- style.perl.7.orig	Sun Nov  5 18:50:26 2000
+++ style.perl.7	Sun Nov  5 22:58:44 2000
@@ -23,66 +23,68 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD: src/share/man/man7/style.perl.7,v 1.12 2000/10/19 18:18:35 joe Exp $
+.\" jpman %Id%
 .\"
 .Dd October 16, 2000
 .Dt STYLE.PERL 7
 .Os FreeBSD
-.Sh NAME
+.Sh $BL>>N(B
 .Nm style.perl 7
-.Nd "FreeBSD Perl source file style guide"
-.Sh DESCRIPTION
-This file specifies the preferred style for perl scripts in the
+.Nd "FreeBSD Perl $B%=!<%9%U%!%$%k$N%9%?%$%k%,%$%I(B"
+.Sh $B2r@b(B
+$B$3$N%U%!%$%k$O(B
 .Tn FreeBSD
-source tree.
+$B%=!<%9%D%j!<$N(B perl $B%9%/%j%W%H$K9%$^$7$$%9%?%$%k$rL@5-$7$F$$$^$9!#(B
 .Bd -literal -offset 0i
  #
- # Style guide for Perl.  Based on the kernel style guide.
+ # Perl $B$N$?$a$N%9%?%$%k%,%$%I$G$9!#(B
+ # $B%+!<%M%k$N%9%?%$%k%,%$%I$K4p$E$$$F$$$^$9!#(B
  #
 
  #
- # VERY important single-line comments look like this.
+ # $B$H$F$b=EMW$J(B 1 $B9T$N%3%a%s%H$O$3$N$h$&$K$7$^$9!#(B
  #
 
- # Most single-line comments look like this.
+ # $BKX$I$N(B 1 $B9T$N%3%a%s%H$O$3$N$h$&$K$7$^$9!#(B
 
- # Multi-line comments look like this.  Make them real sentences.
- # Fill them so they look like real paragraphs.
+ # $BJ#?t9T$K$o$?$k%3%a%s%H$O$3$N$h$&$K$7$^$9!#<B:]$NJ8>O$r=q$-$^$9!#<B:]$N(B
+ # $BCJMn$K8+$($k$h$&$KKd$a$F$$$-$^$9!#(B
 .Ed
 .Pp
-All scripts should follow the copyright block at the start of the
-script with a comment block that describes what the script does.
+$BA4$F$N%9%/%j%W%H$K$O%9%/%j%W%H$N@hF,$KCx:n8"%V%m%C%/$H!"(B
+$B$=$N%9%/%j%W%H$,2?$r$9$k$b$N$J$N$+$r5-=R$7$?%3%a%s%H%V%m%C%/$,I,MW$G$9!#(B
 .Bd -literal -offset 0i
  #!/usr/bin/perl -w
 
- # COPYRIGHT
- # BLOCK
+ # $BCx:n8"(B
+ # $B%V%m%C%/(B
 
- # This script processes an old kernel config file, which it gets on
- # stdin, and outputs a new style hints file to stdout.
+ # $B$3$N%9%/%j%W%H$OI8=`F~NO$+$i8E$$%+!<%M%k@_Dj%U%!%$%k$rFI$_9~$_!"(B
+ # $BI8=`=PNO$K?7$7$$7A<0$N%R%s%H%U%!%$%k$r=PNO$7$^$9!#(B
 .Ed
-All scripts should use the
+$BA4$F$N%9%/%j%W%H$O(B
 .Fa strict
-module and run without warnings. For example:
+$B%b%8%e!<%k$r;HMQ$7$F7Y9p$J$7$KF0:n$7$J$1$l$P$$$1$^$;$s!#Nc$($P(B:
 .Bd -literal -offset 0i
  #!/usr/bin/perl -w
 
- # Copyright, description of what the script does, etc
+ # $BCx:n8"!"%9%/%j%W%H$NFbMF5-=R!"$=$NB>(B
 
  use strict;
  ...
 .Ed
 .Pp
-Where possible run the script with taint mode switched on.  This
-is documented in
-.Xr perlsec 1 .
+$B2DG=$J>l=j$G$O%9%/%j%W%H$r(B taint ($B1x@w(B) $B%b!<%I$K$7$F(B
+$BF0:n$5$;$F$/$@$5$$!#$3$N$3$H$O(B
+.Xr perlsec 1
+$B$GJ8=q2=$5$l$F$$$^$9!#(B
 .Bd -literal -offset 0i
  #!/usr/bin/perl -wT
 .Ed
 .Pp
-The main program should be placed in a block labeled MAIN:.  This
-makes it easier to identify the entry point in a large perl script,
-and provides a scope for variables which are used in the main
-program but nowhere else.
+$B%a%$%s%W%m%0%i%`$O(B MAIN: $B$H%i%Y%k$5$l$?%V%m%C%/$KCV$/I,MW$,$"$j$^$9!#(B
+$B$3$l$K$h$jBg$-$J(B perl $B%9%/%j%W%H$G3+;OE@$r<1JL$9$k$N$,MF0W$K$J$j!"(B
+$B$^$?%a%$%s%W%m%0%i%`$@$1$G;HMQ$5$l$kJQ?t$KBP$7$F%9%3!<%W$rM?$($^$9!#(B
 .Bd -literal -offset 0i
  MAIN:{
 	print(foo("/usr/bin/man", "7", "style.perl"));
@@ -90,8 +92,9 @@
  }
 .Ed
 .Pp
-All subroutines should be defined using argument prototypes as defined in
-.Xr perlsub 1 .
+$BA4$F$N%5%V%k!<%A%s$O(B
+.Xr perlsub 1
+$B$GDj5A$5$l$F$$$k$h$&$J%W%m%H%?%$%W0z?t$r;HMQ$7$FDj5A$9$kI,MW$,$"$j$^$9!#(B
 .Bd -literal -offset 0i
  sub foo($@) {
 	my $cmd = shift;
@@ -99,71 +102,71 @@
  }
 .Ed
 .Pp
-All variables should be defined before use; this is enforced if operating
-under
-.Fa use strict .
+$BA4$F$NJQ?t$O;HMQ$9$kA0$KDj5A$5$l$F$$$kI,MW$,$"$j$^$9(B; $B$3$l$O(B
+.Fa use strict
+$B2<$GMxMQ$9$k>l9g$O6/@)$5$l$^$9!#(B
 .Pp
-Scope local variables should be defined using
+$B%m!<%+%kJQ?t$N%9%3!<%W$NDj5A$K$O(B
+.Fa local
+.Va $variable
+$B$G$O$J$/(B
 .Fa my
 .Va $variable
-and not
-.Fa local
-.Va $variable .
-The
-.Fa local
-declaration should only be used when it is required, and not by
-default.  Lots of perl4 scripts use
+$B$rMQ$$$kI,MW$,$"$j$^$9!#(B
 .Fa local
-because the
+$B@k8@$O$=$l$,I,MW$H$5$l$k>lLL$K$N$_;HMQ$7!"%G%U%)%k%H$G$O;HMQ$7$F$O$$$1$^$;$s!#(B
+$B$?$/$5$s$N(B perl4 $B%9%/%j%W%H$O(B
 .Fa my
-definition didn't exist prior to perl5.
+$BDj5A$,(B perl5 $B0JA0$K$OB8:_$7$J$+$C$?$H$$$&M}M3$G(B
+.Fa local
+$B$r;HMQ$7$F$$$^$9!#(B
 .Pp
-In most cases globals should be defined at the top of the code
-using a
+$BB?$/$N>l9g%0%m!<%P%kJQ?t$O%3!<%I$N@hF,$G(B
 .Fa vars
-definition block:
+$BDj5A%V%m%C%/$r;HMQ$7$FDj5A$9$kI,MW$,$"$j$^$9(B:
 .Bd -literal -offset 0i
  use vars qw($globalscalar @globalarray %globalhash);
 .Ed
 .Pp
-In some cases it may be appropriate to use
-.Fa my
-statements at the top of the script as an alternative to using
+$B>l9g$K$h$C$F$O%9%/%j%W%H$N@hF,$G(B
 .Fa vars
-declarations.
+$B@k8@$G$O$J$/(B
+.Fa my
+$BJ8$rMQ$$$k$N$,E,$7$F$$$k$3$H$b$"$j$^$9!#(B
 .Pp
-All variables should be commented.
+$BA4$F$NJQ?t$K$O%3%a%s%H$r$D$1$kI,MW$,$"$j$^$9!#(B
 .Bd -literal -offset 0i
  sub foo($@) {
-	my $cmd = shift;	# Command to run
-	my @args = @_;		# Arguments to $cmd
+	my $cmd = shift;	# $B<B9T$9$k%3%^%s%I(B
+	my @args = @_;		# $cmd $B$X$N0z?t(B
  }
 .Ed
 .Pp
-Local variables should be separated from function arguments by a
-blank line:
+$B%m!<%+%kJQ?t$O6u9T$K$h$C$F4X?t$N0z?t$HJ,N%$9$kI,MW$,$"$j$^$9(B:
 .Bd -literal -offset 0i
  sub foo($@) {
-	my $cmd = shift;	# Command to run
-	my @args = @_;		# Arguments to command
+	my $cmd = shift;	# $B<B9T$9$k%3%^%s%I(B
+	my @args = @_;		# command $B$X$N0z?t(B
 
-	my $pid;		# Child PID
-	local *PIPE;		# Pipe
-	my $output;		# Output from command
+	my $pid;		# $B;R$N(B PID
+	local *PIPE;		# $B%Q%$%W(B
+	my $output;		# $B%3%^%s%I$+$i$N=PNO(B
  }
 .Ed
 .Pp
-Whenever possible code should be run through the code checker
+$B2DG=$J;~$K$O$$$D$G$b!"(B
+$B%3!<%I$O%3!<%I%A%'%C%+(B
 .Nm perl
 .Ar -wc
 .Ar script.pl
-or
+$B$^$?$O(B
 .Nm perl
 .Ar -wcT
 .Ar script.pl
-and produce no warnings.
+$B$rDL2a$5$;$F$/$@$5$$!#$^$?7Y9p$,@8@.$5$l$F$O$$$1$^$;$s!#(B
 .Pp
-Indentation is an 8 character tab.  Second level indents are four spaces.
+$B%$%s%G%s%H$O(B 8 $BJ8;z$N%?%V$G$9!#(B
+$BBh(B 2 $B%l%Y%k$N%$%s%G%s%H$O(B 4 $BJ8;z$N%9%Z!<%9$G$9!#(B
 .Bd -literal -offset 0i
  while (cnt < 20) {
 	z = a + really + long + statement + that + needs +
@@ -172,21 +175,21 @@
  }
 .Ed
 .Pp
-Do not add whitespace at the end of a line, and only use tabs
-followed by spaces to form the indentation.  Do not use more spaces
-than a tab will produce and do not use spaces in front of tabs.
-.Pp
-Opening braces should be at the end of the controlling line.  Else
-and elsif belong on the same line as the closing brace for the
-previous if or elsif block:
+$B6uGrJ8;z$r9TKv$KDI2C$7$F$O$$$1$^$;$s!#(B
+$B$^$?!"%$%s%G%s%H$r7A@.$9$k$?$a$K$O!"%?%V$H$=$N8e$K%9%Z!<%9$N$_$r;HMQ$7$^$9!#(B
+$B%?%V$,@8$_=P$90J>e$N%9%Z!<%9$d!"%?%V$NA0$N%9%Z!<%9$O;HMQ$7$^$;$s!#(B
+.Pp
+$B%V%l!<%9$N3+;O$O@)8f9T$N:G8e$KCV$+$l$^$9!#(B
+else $B$H(B elsif $B$OD>A0$N(B if $B$^$?$O(B elsif $B%V%m%C%/$N=*N;%V%l!<%9$H(B
+$BF1$89T$KCV$+$l$^$9(B:
 .Bd -literal -offset 0i
  sub foo($@) {
-	my $cmd = shift;            # Command to run
-	my @args = @_;              # Arguments to command
+	my $cmd = shift;            # $B<B9T$9$k%3%^%s%I(B
+	my @args = @_;              # $B%3%^%s%I$X$N0z?t(B
 
-	my $pid;                    # Child PID
-	local *PIPE;                # Pipe
-	my $output;                 # Output from command
+	my $pid;                    # $B;R$N(B PID
+	local *PIPE;                # $B%Q%$%W(B
+	my $output;                 # $B%3%^%s%I$+$i$N=PNO(B
 
 	unless (defined($pid = open(PIPE, "-|"))) {
 		die("open(): $!\\n");
@@ -208,32 +211,32 @@
  }
 .Ed
 .Pp
-Where possible scripts should use standard modules instead of
-rewriting the code inline.  It may be appropriate in some cases to
-import a CPAN module into the base system to facilitate this.
+$B2DG=$J>l=j$G$O%9%/%j%W%H$OI8=`%b%8%e!<%k$r;HMQ$7!"(B
+$B%3!<%I$r$=$N>l$KE83+$7$F$O$$$1$^$;$s!#(B
+$B$3$N$3$H$rB%?J$9$k$?$a$K(B CPAN $B%b%8%e!<%k$r4pK\%7%9%F%`(B
+$B$K<h$j9~$`$3$H$,E,$7$F$$$k>l9g$,$"$k$+$b$7$l$^$;$s!#(B
 .Pp
-Use
-.Fa chomp
-instead of
 .Fa chop
-where appropriate.
+$B$G$O$J$/(B
+.Fa chomp
+$B$r;HMQ$9$Y$->l=j$G$O$=$N$h$&$K$7$F$/$@$5$$!#(B
 .Pp
-Use
-.Fa unless
-instead of
+$B2DFI@-$,A}$9>l9g$K$O(B
 .Fa if (! ... )
-where it improves readability.
+$B$G$O$J$/(B
+.Fa unless
+$B$r;HMQ$7$F$/$@$5$$!#(B
 .Pp
-Where it doesn't conflict with this guide read
+$B$3$N%,%$%I$KL7=b$7$J$$HO0O$G(B
 .Xr perlstyle 1
-and adopt Larry Wall's style recommendations.
-
-.Sh SEE ALSO
+$B$rFI$s$G(B Larry Wall $B$N?d>)%9%?%$%k$r:NMQ$7$F$/$@$5$$!#(B
+.Sh $B4XO"9`L\(B
 .Xr perlsec 1 ,
 .Xr perlstyle 1 ,
 .Xr style 9
-.Sh HISTORY
-This man page is largely based on the
+.Sh $BNr;K(B
+$B$3$N%^%K%e%"%k%Z!<%8$O(B
+.Tn FreeBSD
+$B$N(B
 .Xr style 9
-man-page in
-.Tn FreeBSD .
+$B%^%K%e%"%k%Z!<%8$KBg$-$/4p$E$$$F$$$^$9!#(B
--
$B1n4]K'I'(B (Yoshihiko SARUMARU)
mail: mistral@imasy.or.jp       web: http://www.imasy.or.jp/~mistral/
