Re: [PATCH v4 4/6] send-email: create email parser subroutine

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

 



Samuel GROOT <samuel.groot@xxxxxxxxxxxxxxxx> wrote:
> +++ b/perl/Git.pm

> +sub parse_email {
> +	my %mail = ();
> +	my $fh = shift;
> +	my $last_header;
> +
> +	# Unfold and parse multiline header fields

When you libify, I suggest you localize $/ since $/
may be set to something other than "\n" by a caller
and change the behavior of <$fh> and $fh->getline.

	local $/ = "\n";

> +	while (<$fh>) {
> +		last if /^\s*$/;
> +		s/\r\n|\n|\r//;

And, as Eric Sunshine stated:

		s/\r?\n$//;

Explicitly localizing $/ means you wouldn't have to worry about
multiple \n showing up in the line, either.
And chomp/chop wouldn't work, here.

Otherwise I like the move to Git.pm, thanks.
--
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]