File: DDS.pm

package info (click to toggle)
libdevel-repl-perl 1.002001-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 256 kB
  • ctags: 185
  • sloc: perl: 2,323; makefile: 47
file content (22 lines) | stat: -rw-r--r-- 411 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package Devel::REPL::Plugin::DDS;

use Moose::Role;
use Data::Dump::Streamer ();

around 'print' => sub {
  my $orig = shift;
  my $self = shift;
  my $to_dump = (@_ > 1) ? [@_] : $_[0];
  my $out;
  if (ref $to_dump) {
    my $dds = Data::Dump::Streamer->new;
    $dds->Freezer(sub { "$_[0]"; });
    $dds->Data($to_dump);
    $out = $dds->Out;
  } else {
    $out = $to_dump;
  }
  $self->$orig($out);
};

1;