Utilities.pm

filter: Statementstmt 90.0% 27 / 30 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 1 totaltotal 77.7% 35 / 45 CC 2 SCAR 6.9
CC
2
Cov
82%
new
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« Differences.pm ↑ Summary
1 #!/usr/bin/perl -w
2 #!/usr/bin/perl -d:ptkdb -w
3 #
4  
5 package Data::Utilities;
6  
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 BEGIN
12 1 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶ use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 $VERSION = '0.04';
16 1 @ISA = qw(Exporter);
17 #Give a hoot don't pollute, do not export more than needed by default
18 1 @EXPORT = qw();
19 1 @EXPORT_OK = qw();
20 1 %EXPORT_TAGS = ();
21 }
22  
23  
24 1 ▶use Data::Comparator;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Data::Differences;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use Data::Merger;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use Data::Transformator;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29  
30 sub new
31 0 ▶{
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
32 0 my ($class, %parameters) = @_;
33  
34 0 ▶ my $self = bless ({}, ref ($class) || $class);
Condition0%0/3
ref $class || $class
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table0%0/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
35  
36 0 return $self;
37 }
38  
39  
40 =head1 NAME
41  
42 Data::Utilities - General utilities for nested perl data structures.
43  
44 =head1 SYNOPSIS
45  
46 use Data::Utilities;
47  
48 my $tree
49 = {
50 a1 => {
51 a1 => '-a11',
52 a2 => '-a12',
53 },
54 a2 => {
55 a1 => '-a21',
56 a2 => '-a22',
57 },
58 };
59  
60 my $expected_data
61 = {
62 a1 => {
63 a2 => '-a12',
64 },
65 };
66  
67 my $transformation
68 = Data::Transformator->new
69 (
70 apply_identity_transformation => {
71 a1 => {
72 a2 => 1,
73 },
74 },
75 contents => $tree,
76 name => 'test_transform5',
77 );
78  
79 my $transformed_data = $transformation->transform();
80  
81 use Data::Dumper;
82  
83 print Dumper($transformed_data);
84  
85 my $differences = data_comparator($transformed_data, $expected_data);
86  
87 if ($differences->is_empty())
88 {
89 print "$0: extraction ok\n";
90 }
91 else
92 {
93 print "$0: extraction failed\n";
94 }
95  
96  
97 =head1 DESCRIPTION
98  
99 Data::Utilities contains general tools to transform, merge, compare
100 nested perl data structures. See the documentation of the modules in
101 this package as indicated below.
102  
103 =head1 USAGE
104  
105 There are more documentation comments in Data::Transformator, for the
106 moment I have no time to write better documentation than this. The
107 best way to learn how to use it, is to take a look at the test cases.
108  
109 The Neurospaces project (L<http://www.neurospaces.org/>) makes heavy
110 use of these utilities. So you can find some examples overthere to,
111 especially in the test framework.
112  
113 =head1 AUTHOR
114  
115 Hugo Cornelis
116 CPAN ID: CORNELIS
117 Neurospaces Project
118 hugo.cornelis@gmail.com
119 http://www.neurospaces.org/
120  
121 =head1 COPYRIGHT
122  
123 This program is free software; you can redistribute
124 it and/or modify it under the same terms as Perl itself.
125  
126 The full text of the license can be found in the
127 LICENSE file included with this module.
128  
129  
130 =head1 SEE ALSO
131  
132 Data::Comparator(3), Data::Merger(3), Data::Transformator(3),
133 Data::Differences(3).
134  
135 =cut
136  
137 #################### main pod documentation end ###################
138  
139  
140 1 1;
141 # The preceding line will help the module return a true value
142  
« Differences.pm ↑ Summary