lib/Chj/TerseDumper.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 3 totaltotal 91.8% 34 / 37 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« meta/find-perl.pl ↑ Summary lib/Chj/xperlfunc/t.pm »
1 #
2 # Copyright (c) 2015-2019 Christian Jaeger, copying@christianjaeger.ch
3 #
4 # This is free software, offered under either the same terms as perl 5
5 # or the terms of the Artistic License version 2 or the terms of the
6 # MIT License (Expat version). See the file COPYING.md that came
7 # bundled with this file.
8 #
9  
10 =head1 NAME
11  
12 Chj::TerseDumper
13  
14 =head1 SYNOPSIS
15  
16 use Chj::TerseDumper;
17 my $foo = +{ foo => 1, bar => 10, baz => -1 };
18 is terseDumper($foo), "XXX";
19 is TerseDumper($foo), "XXX";
20  
21 =head1 DESCRIPTION
22  
23 Runs Data::Dumper's Dumper with $Data::Dumper::Terse set to 1.
24  
25 =head1 NOTE
26  
27 This is alpha software! Read the status section in the package README
28 or on the L<website|http://functional-perl.org/>.
29  
30 =cut
31  
32 package Chj::TerseDumper;
33 86 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 86 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 86 ▶use warnings FATAL => 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
36 86 ▶use Exporter "import";
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 86 our @EXPORT = qw(TerseDumper terseDumper);
39 86 our @EXPORT_OK = qw(UnsortedTerseDumper);
40 86 our %EXPORT_TAGS = (all => [@EXPORT, @EXPORT_OK]);
41  
42 86 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 141 ▶sub UnsortedTerseDumper {
Subroutine UnsortedTerseDumper: called CC=1 SCAR=0.0
Pod undocumented
45 141 local $Data::Dumper::Terse = 1;
46 141 Dumper(@_)
47 }
48  
49 141 ▶sub TerseDumper {
Subroutine TerseDumper: called CC=1 SCAR=0.0
Pod undocumented
50 141 local $Data::Dumper::Sortkeys = 1;
51 141 UnsortedTerseDumper(@_)
52 }
53  
54 141 ▶sub terseDumper {
Subroutine terseDumper: called CC=1 SCAR=0.0
Pod undocumented
55 141 my $str = TerseDumper(@_);
56 141 chomp $str;
57 141 $str
58 }
59  
60 86 1
« meta/find-perl.pl ↑ Summary lib/Chj/xperlfunc/t.pm »