Apply Caleb patch 3 of 4 (expanded plugin list)
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / DDC.pm
CommitLineData
381b5fa4 1package Devel::REPL::Plugin::DDC;
2
3use Devel::REPL::Plugin;
4use Data::Dumper::Concise ();
5
6around 'format_result' => sub {
7 my $orig = shift;
8 my $self = shift;
9 my $to_dump = (@_ > 1) ? [@_] : $_[0];
10 my $out;
11 if (ref $to_dump) {
12 if (overload::Method($to_dump, '""')) {
13 $out = "$to_dump";
14 } else {
15 $out = Data::Dumper::Concise::Dumper($to_dump);
16 }
17 } else {
18 $out = $to_dump;
19 }
20 $self->$orig($out);
21};
22
231;
24
25__END__
26
27=head1 NAME
28
29Devel::REPL::Plugin::DDC - Format results with Data::Dumper::Concise
30
31=head1 SYNOPSIS
32
33 # in your re.pl file:
34 use Devel::REPL;
35 my $repl = Devel::REPL->new;
36 $repl->load_plugin('DDS');
37 $repl->run;
38
39 # after you run re.pl:
40 $ map $_*2, ( 1,2,3 )
41[
42 2,
43 4,
44 6
45];
46
47 $
48
49=cut
50