From e8f6f29b2cc1e2f1b5374e825b1285d5cc5414aa Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 18 Oct 2000 17:48:10 +0000 Subject: 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. Suggested by: des --- share/man/man7/style.perl.7 | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'share') diff --git a/share/man/man7/style.perl.7 b/share/man/man7/style.perl.7 index 7ca5493..a25fd99 100644 --- a/share/man/man7/style.perl.7 +++ b/share/man/man7/style.perl.7 @@ -137,7 +137,7 @@ blank line: my $pid; # Child PID local *PIPE; # Pipe my $output; # Output from command -} + } .Ed .Pp Whenever possible code should be run through the code checker @@ -150,6 +150,38 @@ or .Ar script.pl and produce no warnings. .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: +.Bd -literal -offset 0i + sub foo($@) { + my $cmd = shift; # Command to run + my @args = @_; # Arguments to command + + my $pid; # Child PID + local *PIPE; # Pipe + my $output; # Output from command + + unless (defined($pid = open(PIPE, "-|"))) { + die("open(): $!\\n"); + } elsif ($pid == 0) { + exec($cmd, @args); + die("exec(): $!\\n"); + } + $output = ""; + while () { + $output .= $_; + } + waitpid($pid, 0); + if ($? & 0xff) { + die("$cmd caught a signal " . ($? & 0x7f) . "\\n"); + } elsif ($?) { + die("$cmd returned exit code " . ($? >> 8) . "\\n"); + } + return $output; + } +.Ed +.Pp Indentation and block style should follow .Xr style 9 where applicable. -- cgit v1.1