1use strict;
2use warnings;
3package Devel::REPL::Plugin::DDC;
4# ABSTRACT: Format results with Data::Dumper::Concise
5
6our $VERSION = '1.003028';
7
8use Devel::REPL::Plugin;
9use Data::Dumper::Concise ();
10use namespace::autoclean;
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
33=pod
34
35=encoding UTF-8
36
37=head1 NAME
38
39Devel::REPL::Plugin::DDC - Format results with Data::Dumper::Concise
40
41=head1 VERSION
42
43version 1.003028
44
45=head1 SYNOPSIS
46
47 # in your re.pl file:
48 use Devel::REPL;
49 my $repl = Devel::REPL->new;
50 $repl->load_plugin('DDS');
51 $repl->run;
52
53 # after you run re.pl:
54 $ map $_*2, ( 1,2,3 )
55[
56  2,
57  4,
58  6
59];
60
61 $
62
63=head1 SUPPORT
64
65Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
66(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).
67
68There is also an irc channel available for users of this distribution, at
69L<C<#devel> on C<irc.perl.org>|irc://irc.perl.org/#devel-repl>.
70
71=head1 AUTHOR
72
73Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>)
74
75=head1 COPYRIGHT AND LICENCE
76
77This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>).
78
79This is free software; you can redistribute it and/or modify it under
80the same terms as the Perl 5 programming language system itself.
81
82=cut
83