Here is what is happening. Your argument list is always being turned into a reference to an array. If you process it that way in your tie implementation, it works just fine. If you don't, then you get your result.
Now if you look in the implementation, in import the variable $tiedata is defined in the following snippet:
Now that looks to me to be an error, if you had an array reference, then leave it alone, if you didn't then try to dereference it as an array reference? If you didn't have an array reference, what possible sense does it make to dereference it as one?if ($cmd =~ /^autotie((?:ref)?)$/) { my $tiedata = '($was_arrayref ? $data : @$data)'; $tiedata = ($1 ? '$ref, ' : '') . $tiedata; my $mapping = shift;
Well if you try switching which branch of the trinary operator the array dereference takes place in, that code reads much more sensibly, and your test works entirely as you expected it to. However if you do that, 2 tests in the test suite fail. So I suspect that this is a bug in the code which was enshrined in the tests.
But I can't be sure of that without asking TheDamian. (I sent him a message.)
In reply to Re (tilly) 1: autotie in Attribute Handlers
by tilly
in thread autotie in Attribute Handlers
by davorg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |