File Coverage

blib/lib/Devel/REPL/Plugin/DDC.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1 2     2   8271 use strict;
  2         6  
  2         211  
2 2     2   10 use warnings;
  2         3  
  2         130  
3             package Devel::REPL::Plugin::DDC;
4             # ABSTRACT: Format results with Data::Dumper::Concise
5              
6             our $VERSION = '1.003028';
7              
8 2     2   8 use Devel::REPL::Plugin;
  2         4  
  2         13  
9 2     2   8323 use Data::Dumper::Concise ();
  2         9013  
  2         50  
10 2     2   11 use namespace::autoclean;
  2         5  
  2         15  
11              
12             around '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              
29             1;
30              
31             __END__
32              
33             =pod
34              
35             =encoding UTF-8
36              
37             =head1 NAME
38              
39             Devel::REPL::Plugin::DDC - Format results with Data::Dumper::Concise
40              
41             =head1 VERSION
42              
43             version 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              
65             Bugs 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              
68             There is also an irc channel available for users of this distribution, at
69             L<C<#devel> on C<irc.perl.org>|irc://irc.perl.org/#devel-repl>.
70              
71             =head1 AUTHOR
72              
73             Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>)
74              
75             =head1 COPYRIGHT AND LICENCE
76              
77             This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>).
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut