Question: I'm writing automated test cases using Javascript to perform GUI actions. I'm writing a function to handle some basic "initialization" operations on the software under test but I wanted to have the option to not necessarily put every argument into the parameters. 

So I had a function that basically did this:

```
function initializeApp(arg1,arg2,arg3,arg4)
{
    action1(arg1);
    action2(arg2);
    action3(arg3);
    action4(arg4);
}

```

But lets say that I didn't want to perform action 4, right now the code contained inside the "action4" block would not be able to handle there not being input for arg4 and would crash. So the hamfisted way I thought about getting around this issue was to create a bunch of `if` and `else if` statements that would essentially skip over different code blocks if that argument was undefined. Here's an example:

```
function testIES(configFile, recordFile, overwrite, scriptFile)
{
    if (arg1 == undefined)
    {
        action2(arg2);
        action3(arg3);
        action4(arg4);
    } else if (arg2 == undefined)
    {
        action1(arg1);
        action3(arg3);
        action4(arg4);
    } else if (arg3 == undefined)
    {
        action1(arg1);
        action2(arg2);
        action4(arg4);
    } else if (arg4 == undefined)
    {
        action1(arg1);
        action2(arg2);
        action3(arg3);
    }
}

```

However, this approach has an obvious flaw in that I'd need to come up with every combination of "actions" if I wanted to be able to leave out more than 1 argument. It would also not be very user friendly if anyone else wanted to do it because they'd have to know not to leave out more than one argument. So is my best option simply coming up with all the different combinations? Or is there a better way? Surely there's a better way.

Answer: 
There was an error in the code: the encoding declared was not actually used when opening the file. I created an issue in the module, and [this pull request to fix it](https://github.com/Tux/CSV/pull/15)
It looks like the documentation for `Text::CSV` requires that [the value passed to `encoding` must be the same as that accepted by the `open` function's `encoding` parameter](https://modules.perl6.org/dist/Text::CSV:cpan:HMBRAND/lib/Text/CSV.pod6#L1856).

The list of possible values is listed in the [`IO::Handle::encoding` method documentation](https://docs.perl6.org/type/IO::Handle#method_encoding):

> 
> The accepted values for encoding are case-insensitive. The available encodings vary by implementation and backend. On Rakudo MoarVM the following are supported:
> 
> 
> * `utf8`
> * `utf16`
> * `utf16le`
> * `utf16be`
> * `utf8-c8`
> * `iso-8859-1`
> * `windows-1251`
> * `windows-1252`
> * `windows-932`
> * `ascii`
> 
> 
> The default encoding is `utf8`, which undergoes normalization into Unicode NFC (normalization form canonical). In some cases you may want to ensure no normalization is done; for this you can use `utf8-c8`. Before using `utf8-c8` please read Unicode: Filehandles and I/O for more information on `utf8-c8` and NFC.
> 
> 
> As of Rakudo 2018.04 `windows-932` is also supported which is a variant of ShiftJIS.
> 
> 
> Implementation may choose to also provide support for aliases, e.g. Rakudo allows aliases `latin-1` for `iso-8859-1` encoding and dashed utf versions: `utf-8` and `utf-16`.
> 
> 
>