line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::NinjaORM::Utils; |
2
|
|
|
|
|
|
|
|
3
|
71
|
|
|
71
|
|
52861
|
use 5.010; |
|
71
|
|
|
|
|
168
|
|
4
|
|
|
|
|
|
|
|
5
|
71
|
|
|
71
|
|
281
|
use strict; |
|
71
|
|
|
|
|
83
|
|
|
71
|
|
|
|
|
1403
|
|
6
|
71
|
|
|
71
|
|
270
|
use warnings; |
|
71
|
|
|
|
|
77
|
|
|
71
|
|
|
|
|
1889
|
|
7
|
|
|
|
|
|
|
|
8
|
71
|
|
|
71
|
|
278
|
use Carp; |
|
71
|
|
|
|
|
86
|
|
|
71
|
|
|
|
|
3726
|
|
9
|
71
|
|
|
71
|
|
41961
|
use Data::Dumper (); |
|
71
|
|
|
|
|
415117
|
|
|
71
|
|
|
|
|
1937
|
|
10
|
71
|
|
|
71
|
|
1801
|
use Data::Validate::Type; |
|
71
|
|
|
|
|
15061
|
|
|
71
|
|
|
|
|
3452
|
|
11
|
|
|
|
|
|
|
|
12
|
71
|
|
|
71
|
|
319
|
use base 'Exporter'; |
|
71
|
|
|
|
|
127
|
|
|
71
|
|
|
|
|
14772
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
15
|
|
|
|
|
|
|
dumper |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
DBIx::NinjaORM::Utils - Utility functions for L. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 VERSION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Version 3.1.0 |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $VERSION = '3.1.0'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Collection of utility functions used by L to perform various |
36
|
|
|
|
|
|
|
ancillary tasks. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use DBIx::NinjaORM::Utils qw( dumper ); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $string = dumper( $data_structure ); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 FUNCTIONS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 dumper() |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Utility to stringify data structures. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $string = DBIx::NinjaORM::Utils::dumper( @data ); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Internally, this uses Data::Dumper::Dumper, but you can switch it to a custom |
55
|
|
|
|
|
|
|
dumper with the following code: |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
local $DBIx::NinjaORM::Utils::DUMPER = sub |
58
|
|
|
|
|
|
|
{ |
59
|
|
|
|
|
|
|
my ( @refs ) = @_; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Create a stringified version. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return $string; |
64
|
|
|
|
|
|
|
}; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
our $DUMPER = undef; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub dumper |
71
|
|
|
|
|
|
|
{ |
72
|
4
|
|
|
4
|
1
|
2627
|
my ( @data ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
4
|
100
|
|
|
|
12
|
if ( defined( $DUMPER ) ) |
75
|
|
|
|
|
|
|
{ |
76
|
2
|
50
|
|
|
|
13
|
carp "The custom dumper function is not a valid code reference" |
77
|
|
|
|
|
|
|
if !Data::Validate::Type::is_coderef( $DUMPER ); |
78
|
|
|
|
|
|
|
|
79
|
2
|
|
|
|
|
26
|
return $DUMPER->( @data ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
else |
82
|
|
|
|
|
|
|
{ |
83
|
2
|
|
|
|
|
11
|
return Data::Dumper::Dumper( @data ); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 BUGS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Please report any bugs or feature requests through the web interface at |
91
|
|
|
|
|
|
|
L. |
92
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
93
|
|
|
|
|
|
|
your bug as I make changes. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SUPPORT |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
perldoc DBIx::NinjaORM::Utils |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
You can also look for information at: |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=over 4 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * GitHub's request tracker |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * CPAN Ratings |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * MetaCPAN |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=back |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 AUTHOR |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Guillaume Aubert, C<< >>. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Copyright 2009-2017 Guillaume Aubert. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This code is free software; you can redistribute it and/or modify it under the |
136
|
|
|
|
|
|
|
same terms as Perl 5 itself. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY |
139
|
|
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
140
|
|
|
|
|
|
|
PARTICULAR PURPOSE. See the LICENSE file for more details. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
1; |
145
|
|
|
|
|
|
|
|