perl5
perl5 copied to clipboard
Make Data::Dumper boolean aware.
Perl now has a literal syntax for
!!1which makes tobuiltin::true!!0which maps tobuiltin::false
But when you use Dumper you see,
perl -MData::Dumper -E'say Data::Dumper::Dumper( { true => !!1, false => !!0 } );'
$VAR1 = {
'false' => '',
'true' => 1
};
And you don't even see that these values pass builtin::is_bool. I think a better display would be.
perl -MData::Dumper -E'say Data::Dumper::Dumper( { true => !!1, false => !!0 } );'
$VAR1 = {
'false' => *builtin::false,
'true' => *builtin::true,
};
But even the !!1 and !!0 would be great.
$ perl -MData::Dumper -E'say Data::Dumper::Dumper( { true => !!1, false => !!0 } );'
$VAR1 = {
'false' => !!0,
'true' => !!1
};
$ perl -v
This is perl 5, version 40, subversion 0 (v5.40.0) built for x86_64-linux-thread-multi-ld
...
This was implemented in Data::Dumper 2.187, which is not on CPAN, so you need perl 5.38 or newer.
@mauke why isn't it on cpan?
Because nobody has done the work to release it yet.
This will only be relevant for 5.36, but it would be nice to do.