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