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