doc patches
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / DDS.pm
CommitLineData
950232b2 1package Devel::REPL::Plugin::DDS;
2
6a5409bc 3use Devel::REPL::Plugin;
950232b2 4use Data::Dump::Streamer ();
5
e22aa835 6around 'format_result' => sub {
950232b2 7 my $orig = shift;
8 my $self = shift;
9 my $to_dump = (@_ > 1) ? [@_] : $_[0];
10 my $out;
11 if (ref $to_dump) {
565d0d47 12 if (overload::Method($to_dump, '""')) {
bbea729e 13 $out = "$to_dump";
14 } else {
15 my $dds = Data::Dump::Streamer->new;
16 $dds->Freezer(sub { "$_[0]"; });
17 $dds->Data($to_dump);
18 $out = $dds->Out;
19 }
950232b2 20 } else {
21 $out = $to_dump;
22 }
23 $self->$orig($out);
24};
25
261;
cfd1094b 27
28__END__
29
30=head1 NAME
31
32Devel::REPL::Plugin::DDS - Format results with Data::Dump::Streamer
33
e4761e81 34=head1 SYNOPSIS
35
36 # in your re.pl file:
37 use Devel::REPL;
38 my $repl = Devel::REPL->new;
39 $repl->load_plugin('DDS');
40 $repl->run;
41
42 # after you run re.pl:
43 $ map $_*2, ( 1,2,3 )
44 $ARRAY1 = [
45 2,
46 4,
47 6
48 ];
49
50 $
51
cfd1094b 52=cut
53