The following Perl 5 script:
use strict;
use warnings;
use Data::Printer;
my @a = (1,2,3,4);
p @a;
gives output:
(note the blue color), whereas this Perl 6 scripts:
use Data::Printer:from<Perl5>;
my @a = 1,2,3,4;
p @a;
gives output:
[
[0] 1,
[1] 2,
[2] 3,
[3] 4
]
but the numbers are not colored (as for the Perl 5 case above).
System information:
$ perl --version
This is perl 5, version 29, subversion 3 (v5.29.3) built for x86_64-linux
$ perl6 -e '.say for $*DISTRO, $*VM, $*PERL.compiler.version'
ubuntu (18.10.Cosmic.Cuttlefish)
moar (2018.11)
v2018.11
This seems to be an issue with version 0.40 of Data::Printer
which is the current version on metacpan. If I install version 0.99 from GitHub I get colors with Perl 6 also. See also this issue.
I debugged version 0.40 a little bit, and it seems like the only difference between the call to p @a
from Perl 5 version versus the same call from Perl 6, is that the Perl 6 call is called in list context, so wantarray
returns true for the Perl 6 call, this apparantly makes Data::Printer
turn off coloring somehow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With