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