This fixes the DDS plugin so that it displays lists of
values when a list is returned. The original code would
wrap everything in [ ] so you never could see a difference
from the default output from the REPL print...
use Data::Dump::Streamer ();
around 'format_result' => sub {
- my $orig = shift;
- my $self = shift;
- my $to_dump = (@_ > 1) ? [@_] : $_[0];
- my $out;
- if (ref $to_dump) {
- if (overload::Method($to_dump, '""')) {
- $out = "$to_dump";
- } else {
- my $dds = Data::Dump::Streamer->new;
- $dds->Freezer(sub { "$_[0]"; });
- $dds->Data($to_dump);
- $out = $dds->Out;
- }
- } else {
- $out = $to_dump;
- }
- $self->$orig($out);
+ my $orig = shift;
+ my $self = shift;
+ my @to_dump = @_;
+ my $out;
+ if (@to_dump != 1 || ref $to_dump[0]) {
+ if (@to_dump == 1 && overload::Method($to_dump[0], '""')) {
+ $out = "@to_dump";
+ } else {
+ my $dds = Data::Dump::Streamer->new;
+ $dds->Freezer(sub { "$_[0]"; });
+ $dds->Data(@to_dump);
+ $out = $dds->Out;
+ }
+ } else {
+ $out = $to_dump[0];
+ }
+ $self->$orig($out);
};
1;