File Coverage

blib/lib/Devel/REPL/Plugin/DDS.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   97901 use strict;
  2         4  
  2         122  
2 2     2   14 use warnings;
  2         3  
  2         154  
3             package Devel::REPL::Plugin::DDS;
4             # ABSTRACT: Format results with Data::Dump::Streamer
5              
6             our $VERSION = '1.003027';
7              
8 2     2   15 use Devel::REPL::Plugin;
  2         4  
  2         23  
9 2     2   12365 use Data::Dump::Streamer ();
  2         60097  
  2         64  
10 2     2   15 use namespace::autoclean;
  2         4  
  2         23  
11              
12             around 'format_result' => sub {
13             my $orig = shift;
14             my $self = shift;
15             my @to_dump = @_;
16             my $out;
17             if (@to_dump > 1 || ref $to_dump[0]) {
18             if (@to_dump == 1 && overload::Method($to_dump[0], '""')) {
19             $out = "@to_dump";
20             } else {
21             my $dds = Data::Dump::Streamer->new;
22             $dds->Freezer(sub { "$_[0]"; });
23             $dds->Data(@to_dump);
24             $out = $dds->Out;
25             }
26             } else {
27             $out = $to_dump[0];
28             }
29             $self->$orig($out);
30             };
31              
32             1;
33              
34             __END__
35              
36             =pod
37              
38             =encoding UTF-8
39              
40             =head1 NAME
41              
42             Devel::REPL::Plugin::DDS - Format results with Data::Dump::Streamer
43              
44             =head1 VERSION
45              
46             version 1.003027
47              
48             =head1 SYNOPSIS
49              
50             # in your re.pl file:
51             use Devel::REPL;
52             my $repl = Devel::REPL->new;
53             $repl->load_plugin('DDS');
54             $repl->run;
55              
56             # after you run re.pl:
57             $ map $_*2, ( 1,2,3 )
58             $ARRAY1 = [
59             2,
60             4,
61             6
62             ];
63              
64             $
65              
66             =head1 AUTHOR
67              
68             Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>)
69              
70             =head1 COPYRIGHT AND LICENSE
71              
72             This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>).
73              
74             This is free software; you can redistribute it and/or modify it under
75             the same terms as the Perl 5 programming language system itself.
76              
77             =cut