Subject: | Does not actually work like print when handling an array |
I don't see that this has been reported before, which I find a little surprising, so it's likely I
just didn't see it in the list of open or closed bugs.
The documentation in Log::Dispatch claims:
Show quoted text
> These methods act like Perl's print built-in when given a list of arguments. Thus, the
following calls are equivalent
However, it really works like Perl's "@array" built-in. The difference is, as I'm sure you know,
that:
print @array;
prints out @array joined by $OUTPUT_FIELD_SEPARATOR aka $, whereas:
print "@array"; # which is essentially what Log::Dispatch actually does
prints out @array joined by $LIST_SEPARATOR aka $".
The default for $OUTPUT_FIELD_SEPARATOR is and empty string ("") and the default for
$LIST_SEPARATOR is a space (" ").
If you want it to actually work like print, the work-around is to either change
$LIST_SEPARATOR (with global repercussions) or use a $scalar joined the other way rather
than an @array as an argument to the log methods:
$self->debug(join $,, @array);
I'd really rather join $,, @_ were the strategy used, but I think an update to the documentation
to honestly describe the use of array stringification would be good, if nothing else.