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   14601 use strict;
  2         6  
  2         83  
2 2     2   16 use warnings;
  2         3  
  2         153  
3             package Devel::REPL::Plugin::DDC;
4             # ABSTRACT: Format results with Data::Dumper::Concise
5              
6             our $VERSION = '1.003027';
7              
8 2     2   13 use Devel::REPL::Plugin;
  2         4  
  2         20  
9 2     2   12570 use Data::Dumper::Concise ();
  2         8873  
  2         69  
10 2     2   18 use namespace::autoclean;
  2         4  
  2         26  
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.003027
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 AUTHOR
64              
65             Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>)
66              
67             =head1 COPYRIGHT AND LICENSE
68              
69             This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>).
70              
71             This is free software; you can redistribute it and/or modify it under
72             the same terms as the Perl 5 programming language system itself.
73              
74             =cut