Re: [PATCH v2 17/22] git-remote-mediawiki: Brace file handles for print for more clarity
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jun 8, 2013, 00:42 UTC
- Message-ID
- <CAPig+cQwBV5OfxH3-XrMd=J-fzTLmdSmoGOp-5o-Cj9mzJoVrw@mail.gmail.com>
- In-Reply-To
- <1370641344-4253-18-git-send-email-celestin.matte@ensimag.fr>
On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte <celestin.matte@ensimag.fr> wrote:
Show 22 quoted lines
> This follows the following rule:
> InputOutput::RequireBracedFileHandleWithPrint (Severity: 1)
> The `print' and `printf' functions have a unique syntax that supports an
> optional file handle argument. Conway suggests wrapping this argument in
> braces to make it visually stand out from the other arguments. When you
> put braces around any of the special package-level file handles like
> `STDOUT', `STDERR', and `DATA', you must the `'*'' sigil or else it
> won't compile under `use strict 'subs''.
>
> print $FH "Mary had a little lamb\n"; #not ok
> print {$FH} "Mary had a little lamb\n"; #ok
>
> print STDERR $foo, $bar, $baz; #not ok
> print {STDERR} $foo, $bar, $baz; #won't compile under 'strict'
> print {*STDERR} $foo, $bar, $baz; #perfect!
>
> Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
>
> Conflicts:
>
> contrib/mw-to-git/git-remote-mediawiki.perlUninteresting conflict information can be dropped.