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