Re: [PATCH 1/5] gitweb: Add a comment explaining the meaning of $/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 4, 2013 at 6:34 PM, Jakub Narębski <jnareb@xxxxxxxxx> wrote:
> On Wed, Dec 4, 2013 at 4:46 PM, Krzesimir Nowak <krzesimir@xxxxxxxxxxxx> wrote:
>> On Wed, 2013-12-04 at 16:11 +0100, Jakub Narębski wrote:
>>> On Wed, Dec 4, 2013 at 2:42 PM, Krzesimir Nowak <krzesimir@xxxxxxxxxxxx> wrote:
>>>
>>> > So future reader will know what does it mean without running "perldoc
>>> > perlvar".
>>>
>>> Hmmm... shouldn't future reader know it anyway?  It is not that cryptic.
>>> I'd say it is idiomatic Perl.
>>
>> It's plainly obscure. And I think it is not that often used - I keep
>> forgetting what that pair of punctuation is actually meaning.
>
> I think it depends on what kind of Perl code one is used to. It is not
> as obscure as $; and similar to $|, I think.
>
>> In this case I guess it would be more readable to use the following code
>> instead:
>>
>>    $fh->input_record_separator ("\0");
>
> That would be a good change to replace
>
>         local $/ = "\0";
>
>         open my $fh, "-|", git_cmd(), ..., '-z', ...
>
> with
>
>         open my $fh, "-|", git_cmd(), ..., '-z', ...
>         $fh->input_record_separator ("\0");
>
> (not forgetting about "use IO::Handle", which module is core Perl module);

Actually it is replacing

         local $/ = "\0";

with

        IO::Handle->input_record_separator("\0");

see http://p3rl.org/IO::Handle
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]