[Ferm] Suggested Patch - Allow @cat to work with arrays
Max Kellermann
max at duempel.org
Thu Sep 26 16:55:36 CEST 2013
On 2013/09/03 12:34, Jan Walzer <jan.walzer at 1und1.de> wrote:
> $VERSION = '2.2.1';
> -$VERSION .= '~git';
> +$VERSION .= '~git-jw';
That doesn't belong here.
> ## interface variables
> # %option = command line and other options
> @@ -1253,8 +1253,9 @@ sub getvalues {
> } elsif ($token eq '@cat') {
> my $value = '';
> map {
> - error('String expected') if ref $_;
> - $value .= $_;
> } get_function_params();
> return $value;
> } elsif ($token eq '@substr') {
>
>
> Of course it would be better, to have a way to specify the "joiner"
> instead of heaving '_' hardcoded there.
> But please, can we have some way of "joining an array of strings" back?
By definition, @cat concatenates all arguments. That forbids the
underscore you chose, because you arbitrarily take that underscore out
of nowhere.
> + $value .= (ref $_)?
> + join('_',@{$_}):
> + $_;
You should better check "ref$_ eq 'ARRAY'" like other functions are
doing it. Check out "sub to_array". Maybe you should write a
function "sub cat_array" which takes either a string or an array?
Oh, and please get your indentation / coding style right.
When you resubmit the patch, please add a commit message. No "hi" and
"bye" and no "thanks". Just the commit message explaining your commit
in subject and email body, and the patch.
Max
More information about the Ferm
mailing list