Subject: Re: [PATCH v3 21/28] git-remote-mediawiki: Put long code into a subroutine

From: Célestin Matte <[email-masked]>
Date: Wed, 12 Jun 2013 00:24:43 +0200

Oops, forgot to take this into account before sending v4 of my series of
patch. I just noticed that, sorry...

Le 11/06/2013 17:42, Junio C Hamano a écrit :
> I am guessing that the new sub, parse_command, uses a local @cmd and
> this is an attempt to avoid using the same name, but this renaming
> of the variable is not explained.

This is indeed what I intended to do.

> I also wonder if you need this global @cmd/@cmds.  Instead of
> passing cmdref, wouldn't it be simpler to have the helper split the
> line, i.e. something like...
> 
> 	sub parse_command {
> 		my ($line) = @_;
>                 my @cmd = split(/ /, $line);
> 		unless (defined @cmd) {
> 	                return 0;
> 		}
>                 ... check capabilities, list, etc....
> 		return 1;
> 	}
> 
>         while (<STDIN>) {
>         	chomp;
>                 if (!parse_command($_)) {
> 			unknown command, aborting
>                         last;
> 		}
> 	}
> 
> 

-- 
Célestin Matte