Re: [PATCH RFC 3/6] send-email: Handle "GIT:" rather than "GIT: " during --compose

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

 



Michael Witten <mfwitten@xxxxxxxxx> writes:

>> Because "while (<>)" does not localize $_, you are clobbering it in the
>> caller's context.  I do not know if any of the the existing callers cares,
>> but it is a change in behaviour.
>
> How about:
>
>     while (local $_ = <$fh>)
>
> Or, in our case, this:
>
>     while (my $_ = <$fh>)

Special variables like $_ cannot be made into lexicals, unless you know
you will only run with a very recent version of Perl (5.9.1, I think).

If you do not want to worry about portability, typically it is easiest to
say "local ($_)" upfront in the beginning of a sub.

I do not understand why you want to change the original

	while (my $line = <$fh>) {
        	...
	}

though.
--
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]